Package pilot :: Package impl :: Module pilotdata_manager :: Class DataUnit

Class DataUnit

source code


DataUnit (DU).

This is the object that is returned by the ComputeDataService when a new DataUnit is created based on a DataUnitDescription.

The DataUnit object can be used by the application to keep track of a DataUnit.

A DataUnit has state, can be queried and can be cancelled.

State model:

Instance Methods
 
__init__(self, pilot_data=None, data_unit_description=None, du_url=None)
1.) create a new Pilot Data: pilot_data_service and data_unit_description required 2.) reconnect to an existing Pilot Data: du_url required
source code
 
cancel(self)
Cancel the Data Unit.
source code
 
add_files(self, file_url_list=[])
Add files referenced in list to Data Unit
source code
 
remove_files(self, file_urls)
Remove files from Data Unit (NOT implemented yet
source code
 
list(self)
List all items contained in DU ...
source code
 
get_state(self)
Return current state of DataUnit
source code
 
wait(self)
Wait until in running state (or failed state)
source code
 
add_pilot_data(self, pilot_data)
add this DU (self) to a certain pilot data data will be moved into this data
source code
 
get_pilot_data(self)
get a list of pilot data that have a copy of this PD
source code
 
export(self, target_url)
simple implementation of export: copies file from first pilot data to local machine
source code
 
get_url(self)
Return URL that can be used to reconnect to Data Unit
source code
 
to_dict(self)
Internal method that returns a dict with all data contained in this DataUnit
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  DU_ID_PREFIX = 'du-'
Properties
  description (Inherited from pilot.api.data.api.DataUnit)
  file_list (Inherited from pilot.api.data.api.DataUnit)
  id (Inherited from pilot.api.data.api.DataUnit)
  state (Inherited from pilot.api.data.api.DataUnit)

Inherited from object: __class__

Method Details

__init__(self, pilot_data=None, data_unit_description=None, du_url=None)
(Constructor)

source code 

1.) create a new Pilot Data: pilot_data_service and data_unit_description required 2.) reconnect to an existing Pilot Data: du_url required

Overrides: object.__init__

cancel(self)

source code 

Cancel the Data Unit.

Overrides: api.data.api.DataUnit.cancel

list(self)

source code 
List all items contained in DU 
{
    "filename" : { 
                    "pilot_data" : [url1, url2],
                    "local" : url
                 }
}        

get_state(self)

source code 

Return current state of DataUnit

Overrides: api.data.api.DataUnit.get_state

wait(self)

source code 

Wait until in running state (or failed state)

Overrides: api.data.api.DataUnit.wait

export(self, target_url)

source code 

simple implementation of export: copies file from first pilot data to local machine

Overrides: api.data.api.DataUnit.export

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)