pilot.api.data.api

Package pilot :: Package api :: Package data :: Module api |

# Source Code for Module pilot.api.data.api

      1  """
      2  This file contains the API for the PilotData Framework.
      3  """
      4
      5 -class PilotDataDescription(dict):
      6      """ B{PilotDataDescription (PDD).}
      7
      8          Dictionary based description containing reference to resource for Pilot Data.
      9
     10          Example::
     11
     12              {
     13              'service_url': "ssh://localhost/tmp/pilotstore/",
     14              'size':100,
     15
     16              # Affinity
     17              'affinity_datacenter_label',    # pilot stores sharing the same label are located in the same data center
     18              'affinity_machine_label',       # pilot stores sharing the same label are located on the same machine
     19              }
     20
     21          Alternatively, a regular Python dictionary can be used.
     22      """
     23
     24 -    def __init__(self):
     25          pass
     26
     27
     28 -    def __setattr__(self, attr, value):
     29          self[attr]=value
     30
     31
     32 -    def __getattr__(self, attr):
     33          return self[attr]
     34
     35
     36
     37 -class PilotData(object):
     38      """ B{PilotData (PD)}.  """
     39
     40      # Class members
     41      __slots__ = (
     42          'id',           # Reference to this PJ
     43          'description',  # Description of PilotData
     44          'context',      # SAGA context
     45          'resource_url', # Resource  URL
     46          'state',        # State of the PilotData
     47          'state_detail', # Adaptor specific state of the PilotData
     48      )
     49
     50 -    def __init__(self):
     51          raise  NotImplementedError("Abstract super class, please use PilotData implementation class in pilot namespace")
     52
     53
     54 -    def cancel(self):
     55          """ Cancel PilotData
     56
     57              Keyword arguments:
     58              None
     59          """
     60          pass
     61
     62
     63 -    def get_state(self):
     64          pass
     65
     66
     67
     68
     69 -class PilotDataService(object):
     70      """ B{PilotDataService (PDS).} """
     71
     72      # Class members
     73      __slots__ = (
     74          'id',           # Reference to this PJS
     75          'state',       # Status of the PJS
     76          'pilot_data'    # List of PJs under this PJS
     77      )
     78
     79 -    def __init__(self, pss_id=None):
     80          """ Create a PilotDataService
     81
     82              Keyword arguments:
     83              pss_id -- restore from pss_id
     84          """
     85          raise  NotImplementedError("Abstract super class, please use PilotDataService implementation class in pilot namespace")
     86
     87
     88 -    def create_pilot(self, pilot_data_description):
     89          """ Create a PilotData
     90
     91              Keyword arguments:
     92              pilot_data_description -- PilotData Description
     93
     94              Return value:
     95              A PilotData handle
     96          """
     97          pass
     98
     99 -    def list_pilots(self):
    100          """ List all PDs of PDS """
    101          pass
    102
    103 -    def cancel(self):
    104          """ Cancel the PilotDataService.
    105
    106              Keyword arguments:
    107              None
    108
    109              Return value:
    110              Result of operation
    111          """
    112          pass
    113
    114
    115  #
    116  # PilotDataService
    117  #
    118 -class DataUnitService(object):
    119      """ B{DataUnitService (DUS).}
    120
    121          Please use ComputeDataService
    122      """
    123
    124 -    def __init__(self, pds_id=None):
    125          """ Create a DataUnitService.
    126
    127              Keyword arguments:
    128              pds_id -- Reconnect to an existing DataUnitService
    129          """
    130          raise  NotImplementedError("Abstract super class, please use DataUnitService implementation class in pilot namespace")
    131
    132
    133 -    def add_pilot_data_service(self, pss):
    134          """ Add a PilotDataService
    135
    136              Keyword arguments:
    137              pss -- The PilotDataService to add.
    138
    139              Return:
    140              Result
    141          """
    142          pass
    143
    144 -    def remove_pilot_data_service(self, pss):
    145          """ Remove a PilotDataService
    146
    147
    148              Keyword arguments:
    149              pss -- The PilotDataService to remove
    150              Return:
    151              Result
    152          """
    153          pass
    154
    155
    156 -    def list_pilot_data(self):
    157          """ List all PDs of PDS """
    158          pass
    159
    160
    161 -    def submit_pilot_data_set(self, data_unit_description):
    162          """ Create Pilot Data object and schedule it to a Pilot Data """
    163          pass
    164
    165
    166 -    def cancel(self):
    167          """ Cancel the PDS.
    168
    169              Keyword arguments:
    170              None
    171
    172              Return:
    173              Result
    174          """
    175          pass
    176
    177
    178 -    def get_state(self):
    179          pass
    180
    181
    182 -    def get_id(self):
    183          pass
    184
    185  #
    186  # DataUnitDescription
    187  #
    188 -class DataUnitDescription(dict):
    189      """ B{DataUnitDescription (DUD).}
    190
    191          Description object for the creation of L{DataUnit}s::
    192
    193              {
    194                  'file_urls': [file1, file2, file3]
    195              }
    196
    197          Currently, no directories supported
    198      """
    199
    200 -    def __init__(self):
    201          pass
    202
    203 -    def __setattr__(self, attr, value):
    204          self[attr]=value
    205
    206 -    def __getattr__(self, attr):
    207          return self[attr]
    208
    209
    210  #
    211  # DataUnit
    212  #
    213 -class DataUnit(object):
    214      """ B{DataUnit (DU).}
    215
    216          Holds a set of files (that generally share the same locality and are used together).
    217      """
    218
    219      # Class members
    220      __slots__ = (
    221          'id',               # Reference
    222          'description',      # Description
    223          'state',            # State
    224          'file_list'        # files managed by PilotData object
    225      )
    226
    227 -    def cancel(self):
    228          """ Cancel the PD. """
    229          raise  NotImplementedError("Abstract super class, please use DataUnit implementation class in pilot namespace")
    230
    231
    232 -    def get_state(self):
    233          """
    234              get current state of Pilot Data:
    235                  New => Initialized
    236                  Pending => Files are synchronized with a pilot store
    237                  Running => PD is in sync with all replicas
    238                  Done => Terminated
    239          """
    240          pass
    241
    242
    243 -    def wait(self):
    244          """ Wait until in Running state
    245              (or Failed state)
    246          """
    247          pass
    248
    249 -    def export(self, target_directory):
    250          """ copies content of PD to a directory on the local machine"""
    251          pass
    252