Ignore:
Timestamp:
09/17/12 23:25:29 (12 years ago)
Author:
mmamonski
Message:

Wrap PBS API in single class

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/pbs_drmaa/pbs_conn.h

    r48 r76  
    11/* $Id$ */ 
    22/* 
    3  *  FedStage DRMAA for PBS Pro 
    4  *  Copyright (C) 2006-2009  FedStage Systems 
     3 *  PSNC DRMAA for Torque/PBS Pro 
     4 *  Copyright (C) 2012 Poznan Supercomputing and Networking Center 
    55 * 
    66 *  This program is free software: you can redistribute it and/or modify 
     
    1818 */ 
    1919  
    20 #ifndef __PBS_DRMAA__LOG_READER_H 
    21 #define __PBS_DRMAA__LOG_READER_H 
     20#ifndef __PBS_DRMAA__PBS_CONN_H 
     21#define __PBS_DRMAA__PBS_CONN_H 
    2222 
    2323#ifdef HAVE_CONFIG_H 
     
    3030#include <drmaa_utils/session.h> 
    3131 
    32 typedef struct pbsdrmaa_log_reader_s pbsdrmaa_log_reader_t; 
     32#include <session.h> 
    3333 
    34 pbsdrmaa_log_reader_t *  
    35 pbsdrmaa_log_reader_new ( fsd_drmaa_session_t * session); 
     34#include <pbs_ifl.h> 
     35 
     36typedef struct pbsdrmaa_pbs_conn_s pbsdrmaa_pbs_conn_t; 
     37 
     38pbsdrmaa_pbs_conn_t * pbsdrmaa_pbs_conn_new ( pbsdrmaa_session_t * session, char *server); 
    3639 
    3740void 
    38 pbsdrmaa_log_reader_destroy ( pbsdrmaa_log_reader_t * self ); 
     41pbsdrmaa_pbs_conn_destroy ( pbsdrmaa_pbs_conn_t * self ); 
    3942 
    40 struct pbsdrmaa_log_reader_s { 
    41         fsd_drmaa_session_t *volatile session ; 
     43struct pbsdrmaa_pbs_conn_s { 
     44        pbsdrmaa_session_t *volatile session; 
     45 
     46        char* (*submit) ( pbsdrmaa_pbs_conn_t *self, struct attropl *attrib, char *script, char *destination ); 
     47 
     48        struct batch_status* (*statjob) ( pbsdrmaa_pbs_conn_t *self,  char *job_id, struct attrl *attrib ); 
     49 
     50        void (*statjob_free) ( pbsdrmaa_pbs_conn_t *self, struct batch_status* job_status ); 
     51 
     52        void (*sigjob) ( pbsdrmaa_pbs_conn_t *self, char *job_id, char *signal ); 
     53 
     54        void (*deljob) ( pbsdrmaa_pbs_conn_t *self, char *job_id ); 
     55 
     56        void (*rlsjob) ( pbsdrmaa_pbs_conn_t *self, char *job_id ); 
     57 
     58        void (*holdjob) ( pbsdrmaa_pbs_conn_t *self, char *job_id ); 
    4259         
    43         void (*read_log) ( pbsdrmaa_log_reader_t * self ); 
     60        /* contact string */ 
     61        char *server; 
     62        /* connection descriptor */ 
     63        int connection_fd; 
    4464         
    45         void (*select_file) ( pbsdrmaa_log_reader_t * self ); 
    46          
    47         void (*close) ( pbsdrmaa_log_reader_t * self ); 
    48  
    49         void (*reopen) ( pbsdrmaa_log_reader_t * self ); 
    50  
    51  
    52         /* determines if function should run */ 
    53         bool run_flag; 
    54          
    55         /* date of current file */ 
    56         time_t t;        
    57          
    58         /* log file handle */ 
    59         FILE *fhandle; 
    60          
    61         /* for wait_thread - day changed */ 
    62         bool volatile date_changed; 
    63          
    64         /* for wait_thread - log file first open */ 
    65         bool volatile first_open;        
    66  
    67         char *volatile log_path; 
    68  
    69         off_t volatile current_offset; 
     65        /* timestamp of last usage */ 
     66        time_t last_usage;       
    7067}; 
    7168 
    72 #endif /* __PBS_DRMAA__LOG_READER_H */ 
     69#endif /* __PBS_DRMAA__PBS_CONN_H */ 
Note: See TracChangeset for help on using the changeset viewer.