repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_subarray/app/subarray_device.py
SubarrayDevice.processing_blocks
def processing_blocks(self): """Return list of PBs associated with the subarray. <http://www.esrf.eu/computing/cs/tango/pytango/v920/server_api/server.html#PyTango.server.pipe> """ sbi_ids = Subarray(self.get_name()).sbi_ids pbs = [] for sbi_id in sbi_ids: sb...
python
def processing_blocks(self): """Return list of PBs associated with the subarray. <http://www.esrf.eu/computing/cs/tango/pytango/v920/server_api/server.html#PyTango.server.pipe> """ sbi_ids = Subarray(self.get_name()).sbi_ids pbs = [] for sbi_id in sbi_ids: sb...
Return list of PBs associated with the subarray. <http://www.esrf.eu/computing/cs/tango/pytango/v920/server_api/server.html#PyTango.server.pipe>
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_subarray/app/subarray_device.py#L80-L90
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/datetime_utils.py
datetime_from_isoformat
def datetime_from_isoformat(value: str): """Return a datetime object from an isoformat string. Args: value (str): Datetime string in isoformat. """ if sys.version_info >= (3, 7): return datetime.fromisoformat(value) return datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%f')
python
def datetime_from_isoformat(value: str): """Return a datetime object from an isoformat string. Args: value (str): Datetime string in isoformat. """ if sys.version_info >= (3, 7): return datetime.fromisoformat(value) return datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%f')
Return a datetime object from an isoformat string. Args: value (str): Datetime string in isoformat.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/datetime_utils.py#L7-L17
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.init_device
def init_device(self): """Device constructor.""" Device.init_device(self) # Add anything here that has to be done before the device is set to # its ON state. self._set_master_state('on') self._devProxy = DeviceProxy(self.get_name())
python
def init_device(self): """Device constructor.""" Device.init_device(self) # Add anything here that has to be done before the device is set to # its ON state. self._set_master_state('on') self._devProxy = DeviceProxy(self.get_name())
Device constructor.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L35-L43
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.always_executed_hook
def always_executed_hook(self): """Run for each command.""" _logT = self._devProxy.get_logging_target() if 'device::sip_sdp_logger' not in _logT: try: self._devProxy.add_logging_target('device::sip_sdp/elt/logger') self.info_stream("Test of Tango loggi...
python
def always_executed_hook(self): """Run for each command.""" _logT = self._devProxy.get_logging_target() if 'device::sip_sdp_logger' not in _logT: try: self._devProxy.add_logging_target('device::sip_sdp/elt/logger') self.info_stream("Test of Tango loggi...
Run for each command.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L47-L57
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.configure
def configure(self, value): """Schedule an offline only SBI with SDP.""" # Only accept new SBIs if the SDP is on. if self._sdp_state.current_state != 'on': raise RuntimeWarning('Unable to configure SBIs unless SDP is ' '\'on\'.') # Check tha...
python
def configure(self, value): """Schedule an offline only SBI with SDP.""" # Only accept new SBIs if the SDP is on. if self._sdp_state.current_state != 'on': raise RuntimeWarning('Unable to configure SBIs unless SDP is ' '\'on\'.') # Check tha...
Schedule an offline only SBI with SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L69-L115
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice._get_service_state
def _get_service_state(service_id: str): """Get the Service state object for the specified id.""" LOG.debug('Getting state of service %s', service_id) services = get_service_id_list() service_ids = [s for s in services if service_id in s] if len(service_ids) != 1: ret...
python
def _get_service_state(service_id: str): """Get the Service state object for the specified id.""" LOG.debug('Getting state of service %s', service_id) services = get_service_id_list() service_ids = [s for s in services if service_id in s] if len(service_ids) != 1: ret...
Get the Service state object for the specified id.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L118-L126
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.get_current_service_state
def get_current_service_state(self, service_id: str): """Get the state of a SDP service.""" state = self._get_service_state(service_id) return state.current_state
python
def get_current_service_state(self, service_id: str): """Get the state of a SDP service.""" state = self._get_service_state(service_id) return state.current_state
Get the state of a SDP service.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L130-L133
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.get_target_service_state
def get_target_service_state(self, service_id: str): """Get the state of a SDP service.""" state = self._get_service_state(service_id) return state.target_state
python
def get_target_service_state(self, service_id: str): """Get the state of a SDP service.""" state = self._get_service_state(service_id) return state.target_state
Get the state of a SDP service.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L137-L140
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.allowed_target_sdp_states
def allowed_target_sdp_states(self): """Return a list of allowed target states for the current state.""" _current_state = self._sdp_state.current_state _allowed_target_states = self._sdp_state.allowed_target_states[ _current_state] return json.dumps(dict(allowed_target_sdp_st...
python
def allowed_target_sdp_states(self): """Return a list of allowed target states for the current state.""" _current_state = self._sdp_state.current_state _allowed_target_states = self._sdp_state.allowed_target_states[ _current_state] return json.dumps(dict(allowed_target_sdp_st...
Return a list of allowed target states for the current state.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L168-L174
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.target_sdp_state
def target_sdp_state(self, state): """Update the target state of SDP.""" LOG.info('Setting SDP target state to %s', state) if self._sdp_state.current_state == state: LOG.info('Target state ignored, SDP is already "%s"!', state) if state == 'on': self.set_state(Dev...
python
def target_sdp_state(self, state): """Update the target state of SDP.""" LOG.info('Setting SDP target state to %s', state) if self._sdp_state.current_state == state: LOG.info('Target state ignored, SDP is already "%s"!', state) if state == 'on': self.set_state(Dev...
Update the target state of SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L177-L190
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.health
def health(self): """Health check method, returns the up-time of the device.""" return json.dumps(dict(uptime='{:.3f}s' .format((time.time() - self._start_time))))
python
def health(self): """Health check method, returns the up-time of the device.""" return json.dumps(dict(uptime='{:.3f}s' .format((time.time() - self._start_time))))
Health check method, returns the up-time of the device.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L194-L197
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.scheduling_block_instances
def scheduling_block_instances(self): """Return the a JSON dict encoding the SBIs known to SDP.""" # TODO(BMo) change this to a pipe? sbi_list = SchedulingBlockInstanceList() return json.dumps(dict(active=sbi_list.active, completed=sbi_list.completed, ...
python
def scheduling_block_instances(self): """Return the a JSON dict encoding the SBIs known to SDP.""" # TODO(BMo) change this to a pipe? sbi_list = SchedulingBlockInstanceList() return json.dumps(dict(active=sbi_list.active, completed=sbi_list.completed, ...
Return the a JSON dict encoding the SBIs known to SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L210-L216
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.processing_blocks
def processing_blocks(self): """Return the a JSON dict encoding the PBs known to SDP.""" pb_list = ProcessingBlockList() # TODO(BMo) realtime, offline etc. return json.dumps(dict(active=pb_list.active, completed=pb_list.completed, ...
python
def processing_blocks(self): """Return the a JSON dict encoding the PBs known to SDP.""" pb_list = ProcessingBlockList() # TODO(BMo) realtime, offline etc. return json.dumps(dict(active=pb_list.active, completed=pb_list.completed, ...
Return the a JSON dict encoding the PBs known to SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L219-L225
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice.processing_block_devices
def processing_block_devices(self): """Get list of processing block devices.""" # Get the list and number of Tango PB devices tango_db = Database() pb_device_class = "ProcessingBlockDevice" pb_device_server_instance = "processing_block_ds/1" pb_devices = tango_db.get_devi...
python
def processing_block_devices(self): """Get list of processing block devices.""" # Get the list and number of Tango PB devices tango_db = Database() pb_device_class = "ProcessingBlockDevice" pb_device_server_instance = "processing_block_ds/1" pb_devices = tango_db.get_devi...
Get list of processing block devices.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L228-L245
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_master/app/sdp_master_device.py
SDPMasterDevice._set_master_state
def _set_master_state(self, state): """Set the state of the SDPMaster.""" if state == 'init': self._service_state.update_current_state('init', force=True) self.set_state(DevState.INIT) elif state == 'on': self.set_state(DevState.ON) self._service_...
python
def _set_master_state(self, state): """Set the state of the SDPMaster.""" if state == 'init': self._service_state.update_current_state('init', force=True) self.set_state(DevState.INIT) elif state == 'on': self.set_state(DevState.ON) self._service_...
Set the state of the SDPMaster.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_device.py#L247-L255
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_subarray/app/register_devices.py
register_subarray_devices
def register_subarray_devices(): """Register subarray devices.""" tango_db = Database() LOG.info("Registering Subarray devices:") device_info = DbDevInfo() # pylint: disable=protected-access device_info._class = "SubarrayDevice" device_info.server = "subarray_ds/1" for index in range(16...
python
def register_subarray_devices(): """Register subarray devices.""" tango_db = Database() LOG.info("Registering Subarray devices:") device_info = DbDevInfo() # pylint: disable=protected-access device_info._class = "SubarrayDevice" device_info.server = "subarray_ds/1" for index in range(16...
Register subarray devices.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_subarray/app/register_devices.py#L9-L23
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
add_workflow_definitions
def add_workflow_definitions(sbi_config: dict): """Add any missing SBI workflow definitions as placeholders. This is a utility function used in testing and adds mock / test workflow definitions to the database for workflows defined in the specified SBI config. Args: sbi_config (dict): SBI ...
python
def add_workflow_definitions(sbi_config: dict): """Add any missing SBI workflow definitions as placeholders. This is a utility function used in testing and adds mock / test workflow definitions to the database for workflows defined in the specified SBI config. Args: sbi_config (dict): SBI ...
Add any missing SBI workflow definitions as placeholders. This is a utility function used in testing and adds mock / test workflow definitions to the database for workflows defined in the specified SBI config. Args: sbi_config (dict): SBI configuration dictionary.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L33-L59
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
generate_version
def generate_version(max_major: int = 1, max_minor: int = 7, max_patch: int = 15) -> str: """Select a random version. Args: max_major (int, optional) maximum major version max_minor (int, optional) maximum minor version max_patch (int, optional) maximum patch versio...
python
def generate_version(max_major: int = 1, max_minor: int = 7, max_patch: int = 15) -> str: """Select a random version. Args: max_major (int, optional) maximum major version max_minor (int, optional) maximum minor version max_patch (int, optional) maximum patch versio...
Select a random version. Args: max_major (int, optional) maximum major version max_minor (int, optional) maximum minor version max_patch (int, optional) maximum patch version Returns: str, Version String
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L62-L78
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
generate_sb
def generate_sb(date: datetime.datetime, project: str, programme_block: str) -> dict: """Generate a Scheduling Block data object. Args: date (datetime.datetime): UTC date of the SBI project (str): Project Name programme_block (str): Programme Returns: str, S...
python
def generate_sb(date: datetime.datetime, project: str, programme_block: str) -> dict: """Generate a Scheduling Block data object. Args: date (datetime.datetime): UTC date of the SBI project (str): Project Name programme_block (str): Programme Returns: str, S...
Generate a Scheduling Block data object. Args: date (datetime.datetime): UTC date of the SBI project (str): Project Name programme_block (str): Programme Returns: str, Scheduling Block Instance (SBI) ID.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L81-L97
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
generate_pb_config
def generate_pb_config(pb_id: str, pb_config: dict = None, workflow_config: dict = None) -> dict: """Generate a PB configuration dictionary. Args: pb_id (str): Processing Block Id pb_config (dict, optional) PB configuration. workflow_config ...
python
def generate_pb_config(pb_id: str, pb_config: dict = None, workflow_config: dict = None) -> dict: """Generate a PB configuration dictionary. Args: pb_id (str): Processing Block Id pb_config (dict, optional) PB configuration. workflow_config ...
Generate a PB configuration dictionary. Args: pb_id (str): Processing Block Id pb_config (dict, optional) PB configuration. workflow_config (dict, optional): Workflow configuration Returns: dict, PB configuration dictionary.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L100-L140
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
generate_sbi_config
def generate_sbi_config(num_pbs: int = 3, project: str = 'sip', programme_block: str = 'sip_demos', pb_config: Union[dict, List[dict]] = None, workflow_config: Union[dict, List[dict]] = None, register...
python
def generate_sbi_config(num_pbs: int = 3, project: str = 'sip', programme_block: str = 'sip_demos', pb_config: Union[dict, List[dict]] = None, workflow_config: Union[dict, List[dict]] = None, register...
Generate a SBI configuration dictionary. Args: num_pbs (int, optional): Number of Processing Blocks (default = 3) project (str, optional): Project to associate the SBI with. programme_block (str, optional): SBI programme block pb_config (dict, List[dict], optional): PB configuration...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L143-L189
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
generate_sbi_json
def generate_sbi_json(num_pbs: int = 3, project: str = 'sip', programme_block: str = 'sip_demos', pb_config: Union[dict, List[dict]] = None, workflow_config: Union[dict, List[dict]] = None, register_workflows=T...
python
def generate_sbi_json(num_pbs: int = 3, project: str = 'sip', programme_block: str = 'sip_demos', pb_config: Union[dict, List[dict]] = None, workflow_config: Union[dict, List[dict]] = None, register_workflows=T...
Return a JSON string used to configure an SBI.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L192-L201
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_logger/app/sdp_logger_device.py
SDPLoggerDevice.log
def log(self, argin): """Log a command for the SDP STango ubsystem devices.""" # # Tango Manual Appendix 9 gives the format # argin[0] = millisecond Unix timestamp # argin[1] = log level # argin[2] = the source log device name # argin[3] = the log message ...
python
def log(self, argin): """Log a command for the SDP STango ubsystem devices.""" # # Tango Manual Appendix 9 gives the format # argin[0] = millisecond Unix timestamp # argin[1] = log level # argin[2] = the source log device name # argin[3] = the log message ...
Log a command for the SDP STango ubsystem devices.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_logger/app/sdp_logger_device.py#L41-L56
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/api/scheduling_block.py
get
def get(block_id): """Scheduling block detail resource.""" try: sbi_details = DB.get_block_details([block_id]).__next__() sbi_details['processing_blocks'] = [] pb_ids = sbi_details['processing_block_ids'] for pb_details in DB.get_block_details(pb_ids): sbi_details['pr...
python
def get(block_id): """Scheduling block detail resource.""" try: sbi_details = DB.get_block_details([block_id]).__next__() sbi_details['processing_blocks'] = [] pb_ids = sbi_details['processing_block_ids'] for pb_details in DB.get_block_details(pb_ids): sbi_details['pr...
Scheduling block detail resource.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/scheduling_block.py#L18-L37
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/api/scheduling_block.py
delete
def delete(block_id): """Scheduling block detail resource.""" _url = get_root_url() LOG.debug('Requested delete of SBI %s', block_id) try: DB.delete_sched_block_instance(block_id) response = dict(message='Deleted block: _id = {}'.format(block_id)) response['_links'] = { ...
python
def delete(block_id): """Scheduling block detail resource.""" _url = get_root_url() LOG.debug('Requested delete of SBI %s', block_id) try: DB.delete_sched_block_instance(block_id) response = dict(message='Deleted block: _id = {}'.format(block_id)) response['_links'] = { ...
Scheduling block detail resource.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/scheduling_block.py#L42-L54
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/old.db/init.py
_scheduling_block_ids
def _scheduling_block_ids(num_blocks, start_id, project): """Generate Scheduling Block instance ID""" for i in range(num_blocks): _root = '{}-{}'.format(strftime("%Y%m%d", gmtime()), project) yield '{}-sb{:03d}'.format(_root, i + start_id), \ '{}-sbi{:03d}'.format(_root, i + start_...
python
def _scheduling_block_ids(num_blocks, start_id, project): """Generate Scheduling Block instance ID""" for i in range(num_blocks): _root = '{}-{}'.format(strftime("%Y%m%d", gmtime()), project) yield '{}-sb{:03d}'.format(_root, i + start_id), \ '{}-sbi{:03d}'.format(_root, i + start_...
Generate Scheduling Block instance ID
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/init.py#L22-L27
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/old.db/init.py
_generate_processing_blocks
def _generate_processing_blocks(start_id, min_blocks=0, max_blocks=4): """Generate a number of Processing Blocks""" processing_blocks = [] num_blocks = random.randint(min_blocks, max_blocks) for i in range(start_id, start_id + num_blocks): _id = 'sip-pb{:03d}'.format(i) block = dict(id=_...
python
def _generate_processing_blocks(start_id, min_blocks=0, max_blocks=4): """Generate a number of Processing Blocks""" processing_blocks = [] num_blocks = random.randint(min_blocks, max_blocks) for i in range(start_id, start_id + num_blocks): _id = 'sip-pb{:03d}'.format(i) block = dict(id=_...
Generate a number of Processing Blocks
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/init.py#L30-L38
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/old.db/init.py
_scheduling_block_config
def _scheduling_block_config(num_blocks=5, start_sbi_id=0, start_pb_id=0, project='sip'): """Return a Scheduling Block Configuration dictionary""" pb_id = start_pb_id for sb_id, sbi_id in _scheduling_block_ids(num_blocks, start_sbi_id, ...
python
def _scheduling_block_config(num_blocks=5, start_sbi_id=0, start_pb_id=0, project='sip'): """Return a Scheduling Block Configuration dictionary""" pb_id = start_pb_id for sb_id, sbi_id in _scheduling_block_ids(num_blocks, start_sbi_id, ...
Return a Scheduling Block Configuration dictionary
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/init.py#L41-L53
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/old.db/init.py
add_scheduling_blocks
def add_scheduling_blocks(num_blocks, clear=True): """Add a number of scheduling blocks to the db.""" db_client = ConfigDb() if clear: LOG.info('Resetting database ...') db_client.clear() start_sbi_id = 0 start_pb_id = 0 else: start_sbi_id = len(db_client.get_sche...
python
def add_scheduling_blocks(num_blocks, clear=True): """Add a number of scheduling blocks to the db.""" db_client = ConfigDb() if clear: LOG.info('Resetting database ...') db_client.clear() start_sbi_id = 0 start_pb_id = 0 else: start_sbi_id = len(db_client.get_sche...
Add a number of scheduling blocks to the db.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/init.py#L56-L73
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/old.db/init.py
main
def main(): """Main function""" # Configure the logger log = logging.getLogger('SIP.EC.PCI.DB') handler = logging.StreamHandler() handler.setFormatter(logging.Formatter( '%(name)-20s | %(filename)-15s | %(levelname)-5s | %(message)s')) log.addHandler(handler) log.setLevel(os.getenv('...
python
def main(): """Main function""" # Configure the logger log = logging.getLogger('SIP.EC.PCI.DB') handler = logging.StreamHandler() handler.setFormatter(logging.Formatter( '%(name)-20s | %(filename)-15s | %(levelname)-5s | %(message)s')) log.addHandler(handler) log.setLevel(os.getenv('...
Main function
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/init.py#L76-L88
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_processing_block/app/processing_block_ds.py
main
def main(args=None, **kwargs): """Start the Processing Block device server.""" LOG.info('Starting SDP PB devices.') return run([ProcessingBlockDevice], verbose=True, msg_stream=sys.stdout, args=args, **kwargs)
python
def main(args=None, **kwargs): """Start the Processing Block device server.""" LOG.info('Starting SDP PB devices.') return run([ProcessingBlockDevice], verbose=True, msg_stream=sys.stdout, args=args, **kwargs)
Start the Processing Block device server.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_processing_block/app/processing_block_ds.py#L14-L18
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.get_id
def get_id(date: datetime.datetime) -> str: """Generate a Processing Block (PB) Instance ID. Args: date (datetime.datetime): UTC date of the PB Returns: str, Processing Block ID """ date = date.strftime('%Y%m%d') return 'PB-{}-{}-{:03d}'.format(...
python
def get_id(date: datetime.datetime) -> str: """Generate a Processing Block (PB) Instance ID. Args: date (datetime.datetime): UTC date of the PB Returns: str, Processing Block ID """ date = date.strftime('%Y%m%d') return 'PB-{}-{}-{:03d}'.format(...
Generate a Processing Block (PB) Instance ID. Args: date (datetime.datetime): UTC date of the PB Returns: str, Processing Block ID
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L36-L47
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.dependencies
def dependencies(self) -> List[Dependency]: """Return the PB dependencies.""" dependencies_str = DB.get_hash_value(self.key, 'dependencies') dependencies = [] for dependency in ast.literal_eval(dependencies_str): dependencies.append(Dependency(dependency)) return depe...
python
def dependencies(self) -> List[Dependency]: """Return the PB dependencies.""" dependencies_str = DB.get_hash_value(self.key, 'dependencies') dependencies = [] for dependency in ast.literal_eval(dependencies_str): dependencies.append(Dependency(dependency)) return depe...
Return the PB dependencies.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L89-L95
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.resources_assigned
def resources_assigned(self) -> List[Resource]: """Return list of resources assigned to the PB.""" resources_str = DB.get_hash_value(self.key, 'resources_assigned') resources_assigned = [] for resource in ast.literal_eval(resources_str): resources_assigned.append(Resource(res...
python
def resources_assigned(self) -> List[Resource]: """Return list of resources assigned to the PB.""" resources_str = DB.get_hash_value(self.key, 'resources_assigned') resources_assigned = [] for resource in ast.literal_eval(resources_str): resources_assigned.append(Resource(res...
Return list of resources assigned to the PB.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L98-L104
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.workflow_stages
def workflow_stages(self) -> List[WorkflowStage]: """Return list of workflow stages. Returns: dict, resources of a specified pb """ workflow_stages = [] stages = DB.get_hash_value(self.key, 'workflow_stages') for index in range(len(ast.literal_eval(stages)))...
python
def workflow_stages(self) -> List[WorkflowStage]: """Return list of workflow stages. Returns: dict, resources of a specified pb """ workflow_stages = [] stages = DB.get_hash_value(self.key, 'workflow_stages') for index in range(len(ast.literal_eval(stages)))...
Return list of workflow stages. Returns: dict, resources of a specified pb
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L135-L146
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.add_assigned_resource
def add_assigned_resource(self, resource_type: str, value: Union[str, int, float, bool], parameters: dict = None): """Add assigned resource to the processing block. Args: resource_type (str): Resource type value: Resour...
python
def add_assigned_resource(self, resource_type: str, value: Union[str, int, float, bool], parameters: dict = None): """Add assigned resource to the processing block. Args: resource_type (str): Resource type value: Resour...
Add assigned resource to the processing block. Args: resource_type (str): Resource type value: Resource value parameters (dict, optional): Parameters specific to the resource
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L152-L169
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.remove_assigned_resource
def remove_assigned_resource(self, resource_type: str, value: Union[str, int, float, bool] = None, parameters: dict = None): """Remove assigned resources from the processing block. All matching resources will be removed. If only type is ...
python
def remove_assigned_resource(self, resource_type: str, value: Union[str, int, float, bool] = None, parameters: dict = None): """Remove assigned resources from the processing block. All matching resources will be removed. If only type is ...
Remove assigned resources from the processing block. All matching resources will be removed. If only type is specified all resources of the specified type will be removed. If value and/or parameters are specified they will be used for matching the resource to remove. Args: ...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L175-L202
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock.abort
def abort(self): """Abort the processing_block.""" LOG.debug('Aborting PB %s', self._id) self.set_status('aborted') pb_type = DB.get_hash_value(self.key, 'type') key = '{}:active'.format(self._type) DB.remove_from_list(key, self._id) key = '{}:active:{}'.format(se...
python
def abort(self): """Abort the processing_block.""" LOG.debug('Aborting PB %s', self._id) self.set_status('aborted') pb_type = DB.get_hash_value(self.key, 'type') key = '{}:active'.format(self._type) DB.remove_from_list(key, self._id) key = '{}:active:{}'.format(se...
Abort the processing_block.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L204-L217
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py
ProcessingBlock._mark_updated
def _mark_updated(self): """Update the updated timestamp.""" timestamp = datetime.datetime.utcnow().isoformat() DB.set_hash_value(self.key, 'updated', timestamp)
python
def _mark_updated(self): """Update the updated timestamp.""" timestamp = datetime.datetime.utcnow().isoformat() DB.set_hash_value(self.key, 'updated', timestamp)
Update the updated timestamp.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/processing_block.py#L223-L226
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/api/subarray_list.py
get
def get(): """Subarray list. This method will list all sub-arrays known to SDP. """ _url = get_root_url() LOG.debug('GET Sub array list') sub_array_ids = sorted(DB.get_sub_array_ids()) response = dict(sub_arrays=[]) for array_id in sub_array_ids: array_summary = dict(sub_arrar...
python
def get(): """Subarray list. This method will list all sub-arrays known to SDP. """ _url = get_root_url() LOG.debug('GET Sub array list') sub_array_ids = sorted(DB.get_sub_array_ids()) response = dict(sub_arrays=[]) for array_id in sub_array_ids: array_summary = dict(sub_arrar...
Subarray list. This method will list all sub-arrays known to SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/subarray_list.py#L18-L40
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/api/subarray_list.py
post
def post(): """Generate a SBI.""" _url = get_root_url() LOG.debug("POST subarray SBI.") # TODO(BM) generate sbi_config .. see report ... # ... will need to add this as a util function on the db... sbi_config = {} DB.add_sbi(sbi_config) response = dict() return response, status.HTT...
python
def post(): """Generate a SBI.""" _url = get_root_url() LOG.debug("POST subarray SBI.") # TODO(BM) generate sbi_config .. see report ... # ... will need to add this as a util function on the db... sbi_config = {} DB.add_sbi(sbi_config) response = dict() return response, status.HTT...
Generate a SBI.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/subarray_list.py#L45-L57
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray.set_parameters
def set_parameters(self, parameters_dict): """Set the subarray parameters. Args: parameters_dict (dict): Dictionary of Subarray parameters """ DB.set_hash_value(self._key, 'parameters', parameters_dict) self.publish("parameters_updated")
python
def set_parameters(self, parameters_dict): """Set the subarray parameters. Args: parameters_dict (dict): Dictionary of Subarray parameters """ DB.set_hash_value(self._key, 'parameters', parameters_dict) self.publish("parameters_updated")
Set the subarray parameters. Args: parameters_dict (dict): Dictionary of Subarray parameters
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L84-L91
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray.sbi_ids
def sbi_ids(self) -> List[str]: """Get the list of SBI Ids. Returns: list, list of SBI ids associated with this subarray. """ return ast.literal_eval(DB.get_hash_value(self._key, 'sbi_ids'))
python
def sbi_ids(self) -> List[str]: """Get the list of SBI Ids. Returns: list, list of SBI ids associated with this subarray. """ return ast.literal_eval(DB.get_hash_value(self._key, 'sbi_ids'))
Get the list of SBI Ids. Returns: list, list of SBI ids associated with this subarray.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L94-L101
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray.configure_sbi
def configure_sbi(self, sbi_config: dict, schema_path: str = None): """Add a new SBI to the database associated with this subarray. Args: sbi_config (dict): SBI configuration. schema_path (str, optional): Path to the SBI config schema. """ if not self.active: ...
python
def configure_sbi(self, sbi_config: dict, schema_path: str = None): """Add a new SBI to the database associated with this subarray. Args: sbi_config (dict): SBI configuration. schema_path (str, optional): Path to the SBI config schema. """ if not self.active: ...
Add a new SBI to the database associated with this subarray. Args: sbi_config (dict): SBI configuration. schema_path (str, optional): Path to the SBI config schema.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L107-L120
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray.abort
def abort(self): """Abort all SBIs associated with the subarray.""" for sbi_id in self.sbi_ids: sbi = SchedulingBlockInstance(sbi_id) sbi.abort() self.set_state('ABORTED')
python
def abort(self): """Abort all SBIs associated with the subarray.""" for sbi_id in self.sbi_ids: sbi = SchedulingBlockInstance(sbi_id) sbi.abort() self.set_state('ABORTED')
Abort all SBIs associated with the subarray.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L122-L127
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray.deactivate
def deactivate(self): """Deactivate the subarray.""" DB.set_hash_value(self._key, 'active', 'False') # Remove the subarray from each of the SBIs for sbi_id in self.sbi_ids: SchedulingBlockInstance(sbi_id).clear_subarray() DB.set_hash_value(self._key, 'sbi_ids', []) ...
python
def deactivate(self): """Deactivate the subarray.""" DB.set_hash_value(self._key, 'active', 'False') # Remove the subarray from each of the SBIs for sbi_id in self.sbi_ids: SchedulingBlockInstance(sbi_id).clear_subarray() DB.set_hash_value(self._key, 'sbi_ids', []) ...
Deactivate the subarray.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L138-L145
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray.remove_sbi_id
def remove_sbi_id(self, sbi_id): """Remove an SBI Identifier.""" sbi_ids = self.sbi_ids sbi_ids.remove(sbi_id) DB.set_hash_value(self._key, 'sbi_ids', sbi_ids)
python
def remove_sbi_id(self, sbi_id): """Remove an SBI Identifier.""" sbi_ids = self.sbi_ids sbi_ids.remove(sbi_id) DB.set_hash_value(self._key, 'sbi_ids', sbi_ids)
Remove an SBI Identifier.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L147-L151
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py
Subarray._add_sbi_id
def _add_sbi_id(self, sbi_id): """Add a SBI Identifier.""" sbi_ids = self.sbi_ids sbi_ids.append(sbi_id) DB.set_hash_value(self._key, 'sbi_ids', sbi_ids)
python
def _add_sbi_id(self, sbi_id): """Add a SBI Identifier.""" sbi_ids = self.sbi_ids sbi_ids.append(sbi_id) DB.set_hash_value(self._key, 'sbi_ids', sbi_ids)
Add a SBI Identifier.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/subarray.py#L173-L177
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py
EventQueue.get
def get(self) -> Union[Event, None]: """Get the latest event from the queue. Call this method to query the queue for the latest event. If no event has been published None is returned. Returns: Event or None """ message = self._queue.get_message() ...
python
def get(self) -> Union[Event, None]: """Get the latest event from the queue. Call this method to query the queue for the latest event. If no event has been published None is returned. Returns: Event or None """ message = self._queue.get_message() ...
Get the latest event from the queue. Call this method to query the queue for the latest event. If no event has been published None is returned. Returns: Event or None
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py#L47-L66
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py
EventQueue.get_published_events
def get_published_events(self, process=True) -> List[Event]: """Get a list of published (pending) events. Return a list of Event objects which have been published and are therefore pending to be processed. If the process argument is set to true, any events returned from this method will...
python
def get_published_events(self, process=True) -> List[Event]: """Get a list of published (pending) events. Return a list of Event objects which have been published and are therefore pending to be processed. If the process argument is set to true, any events returned from this method will...
Get a list of published (pending) events. Return a list of Event objects which have been published and are therefore pending to be processed. If the process argument is set to true, any events returned from this method will also be marked as processed by moving them to the processed eve...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py#L68-L110
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py
EventQueue.get_processed_events
def get_processed_events(self) -> List[Event]: """Get all processed events. This method is intended to be used to recover events stuck in the processed state which could happen if an event handling processing an processed event goes down before completing the event processing. ...
python
def get_processed_events(self) -> List[Event]: """Get all processed events. This method is intended to be used to recover events stuck in the processed state which could happen if an event handling processing an processed event goes down before completing the event processing. ...
Get all processed events. This method is intended to be used to recover events stuck in the processed state which could happen if an event handling processing an processed event goes down before completing the event processing. Returns: list[Events], list of event objects.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py#L112-L131
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py
EventQueue.complete_event
def complete_event(self, event_id: str): """Complete the specified event.""" event_ids = DB.get_list(self._processed_key) if event_id not in event_ids: raise KeyError('Unable to complete event. Event {} has not been ' 'processed (ie. it is not in the proces...
python
def complete_event(self, event_id: str): """Complete the specified event.""" event_ids = DB.get_list(self._processed_key) if event_id not in event_ids: raise KeyError('Unable to complete event. Event {} has not been ' 'processed (ie. it is not in the proces...
Complete the specified event.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_events/event_queue.py#L133-L143
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py
add
def add(workflow_definition: dict, templates_root: str): """Add a workflow definition to the Configuration Database. Templates are expected to be found in a directory tree with the following structure: - workflow_id: |- workflow_version |- stage_id |...
python
def add(workflow_definition: dict, templates_root: str): """Add a workflow definition to the Configuration Database. Templates are expected to be found in a directory tree with the following structure: - workflow_id: |- workflow_version |- stage_id |...
Add a workflow definition to the Configuration Database. Templates are expected to be found in a directory tree with the following structure: - workflow_id: |- workflow_version |- stage_id |- stage_version |- <templates> Args...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py#L17-L52
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py
register
def register(workflow_id, workflow_version): """Register an (empty) workflow definition in the database.""" name = "workflow_definitions:{}:{}".format(workflow_id, workflow_version) workflow_definition = dict(id=workflow_id, version=workflow_version, stages=[]) # DB.set_ha...
python
def register(workflow_id, workflow_version): """Register an (empty) workflow definition in the database.""" name = "workflow_definitions:{}:{}".format(workflow_id, workflow_version) workflow_definition = dict(id=workflow_id, version=workflow_version, stages=[]) # DB.set_ha...
Register an (empty) workflow definition in the database.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py#L55-L61
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py
delete
def delete(workflow_id: str = None, workflow_version: str = None): """Delete workflow definitions. Args: workflow_id (str, optional): Optional workflow identifier workflow_version (str, optional): Optional workflow identifier version If workflow_id and workflow_version are None, delete all...
python
def delete(workflow_id: str = None, workflow_version: str = None): """Delete workflow definitions. Args: workflow_id (str, optional): Optional workflow identifier workflow_version (str, optional): Optional workflow identifier version If workflow_id and workflow_version are None, delete all...
Delete workflow definitions. Args: workflow_id (str, optional): Optional workflow identifier workflow_version (str, optional): Optional workflow identifier version If workflow_id and workflow_version are None, delete all workflow definitions.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py#L64-L88
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py
get_workflow
def get_workflow(workflow_id: str, workflow_version: str) -> dict: """Get a workflow definition from the Configuration Database. Args: workflow_id (str): Workflow identifier workflow_version (str): Workflow version Returns: dict, Workflow definition dictionary """ name = "...
python
def get_workflow(workflow_id: str, workflow_version: str) -> dict: """Get a workflow definition from the Configuration Database. Args: workflow_id (str): Workflow identifier workflow_version (str): Workflow version Returns: dict, Workflow definition dictionary """ name = "...
Get a workflow definition from the Configuration Database. Args: workflow_id (str): Workflow identifier workflow_version (str): Workflow version Returns: dict, Workflow definition dictionary
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py#L91-L105
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py
get_workflows
def get_workflows() -> dict: """Get dict of ALL known workflow definitions. Returns list[dict] """ keys = DB.get_keys("workflow_definitions:*") known_workflows = dict() for key in keys: values = key.split(':') if values[1] not in known_workflows: known_workf...
python
def get_workflows() -> dict: """Get dict of ALL known workflow definitions. Returns list[dict] """ keys = DB.get_keys("workflow_definitions:*") known_workflows = dict() for key in keys: values = key.split(':') if values[1] not in known_workflows: known_workf...
Get dict of ALL known workflow definitions. Returns list[dict]
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py#L108-L123
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py
_load_templates
def _load_templates(workflow: dict, templates_root: str): """Load templates keys.""" workflow_template_path = join(templates_root, workflow['id'], workflow['version']) for i, stage_config in enumerate(workflow['stages']): stage_template_path = join(workflow_template...
python
def _load_templates(workflow: dict, templates_root: str): """Load templates keys.""" workflow_template_path = join(templates_root, workflow['id'], workflow['version']) for i, stage_config in enumerate(workflow['stages']): stage_template_path = join(workflow_template...
Load templates keys.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_definitions.py#L126-L140
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/tango_processing_block/app/delete_devices.py
delete_pb_devices
def delete_pb_devices(): """Delete PBs devices from the Tango database.""" parser = argparse.ArgumentParser(description='Register PB devices.') parser.add_argument('num_pb', type=int, help='Number of PBs devices to register.') args = parser.parse_args() log = logging.getLogg...
python
def delete_pb_devices(): """Delete PBs devices from the Tango database.""" parser = argparse.ArgumentParser(description='Register PB devices.') parser.add_argument('num_pb', type=int, help='Number of PBs devices to register.') args = parser.parse_args() log = logging.getLogg...
Delete PBs devices from the Tango database.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_processing_block/app/delete_devices.py#L11-L24
SKA-ScienceDataProcessor/integration-prototype
sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py
main
def main(): """Main function for SPEAD sender module.""" # Check command line arguments. if len(sys.argv) != 2: raise RuntimeError('Usage: python3 async_send.py <json config>') # Set up logging. sip_logging.init_logger(show_thread=False) # Load SPEAD configuration from JSON file. #...
python
def main(): """Main function for SPEAD sender module.""" # Check command line arguments. if len(sys.argv) != 2: raise RuntimeError('Usage: python3 async_send.py <json config>') # Set up logging. sip_logging.init_logger(show_thread=False) # Load SPEAD configuration from JSON file. #...
Main function for SPEAD sender module.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py#L278-L304
SKA-ScienceDataProcessor/integration-prototype
sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py
SpeadSender.fill_buffer
def fill_buffer(heap_data, i_chan): """Blocking function to populate data in the heap. This is run in an executor. """ # Calculate the time count and fraction. now = datetime.datetime.utcnow() time_full = now.timestamp() time_count = int(time_full) time_fr...
python
def fill_buffer(heap_data, i_chan): """Blocking function to populate data in the heap. This is run in an executor. """ # Calculate the time count and fraction. now = datetime.datetime.utcnow() time_full = now.timestamp() time_count = int(time_full) time_fr...
Blocking function to populate data in the heap. This is run in an executor.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py#L82-L98
SKA-ScienceDataProcessor/integration-prototype
sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py
SpeadSender._run_loop
async def _run_loop(self, executor): """Main loop.""" # SPEAD heap descriptor. # One channel per stream and one time index per heap. max_duration_sec = self._config['max_duration_sec'] num_stations = self._config['heap']['num_stations'] num_pols = self._config['heap']['nu...
python
async def _run_loop(self, executor): """Main loop.""" # SPEAD heap descriptor. # One channel per stream and one time index per heap. max_duration_sec = self._config['max_duration_sec'] num_stations = self._config['heap']['num_stations'] num_pols = self._config['heap']['nu...
Main loop.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py#L101-L244
SKA-ScienceDataProcessor/integration-prototype
sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py
SpeadSender.run
def run(self): """Starts the sender.""" # Create the thread pool. executor = concurrent.futures.ThreadPoolExecutor( max_workers=self._config['num_workers']) # Wait to ensure multiple senders can be synchronised. now = int(datetime.datetime.utcnow().timestamp()) ...
python
def run(self): """Starts the sender.""" # Create the thread pool. executor = concurrent.futures.ThreadPoolExecutor( max_workers=self._config['num_workers']) # Wait to ensure multiple senders can be synchronised. now = int(datetime.datetime.utcnow().timestamp()) ...
Starts the sender.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/send/async_send.py#L246-L274
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object_list.py
SchedulingObjectList.set_complete
def set_complete(self, object_id: str): """Mark the specified object as completed.""" if object_id in self.active: DB.remove_from_list('{}:active'.format(self.type), object_id) DB.append_to_list('{}:completed'.format(self.type), object_id)
python
def set_complete(self, object_id: str): """Mark the specified object as completed.""" if object_id in self.active: DB.remove_from_list('{}:active'.format(self.type), object_id) DB.append_to_list('{}:completed'.format(self.type), object_id)
Mark the specified object as completed.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object_list.py#L70-L74
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object_list.py
SchedulingObjectList.publish
def publish(self, object_id: str, event_type: str, event_data: dict = None): """Publish a scheduling object event. Args: object_id (str): ID of the scheduling object event_type (str): Type of event. event_data (dict, optional): Event data. ""...
python
def publish(self, object_id: str, event_type: str, event_data: dict = None): """Publish a scheduling object event. Args: object_id (str): ID of the scheduling object event_type (str): Type of event. event_data (dict, optional): Event data. ""...
Publish a scheduling object event. Args: object_id (str): ID of the scheduling object event_type (str): Type of event. event_data (dict, optional): Event data.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object_list.py#L104-L120
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_block_controller/sip_pbc/tasks.py
_start_workflow_stages
def _start_workflow_stages(pb: ProcessingBlock, pb_id: str, workflow_stage_dict: dict, workflow_stage: WorkflowStage, docker: DockerSwarmClient): """Start a workflow stage by starting a number of docker services. This function fir...
python
def _start_workflow_stages(pb: ProcessingBlock, pb_id: str, workflow_stage_dict: dict, workflow_stage: WorkflowStage, docker: DockerSwarmClient): """Start a workflow stage by starting a number of docker services. This function fir...
Start a workflow stage by starting a number of docker services. This function first assesses if the specified workflow stage can be started based on its dependencies. If this is found to be the case, the workflow stage is stared by first resolving and template arguments in the workflow stage configurat...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_block_controller/sip_pbc/tasks.py#L55-L143
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_block_controller/sip_pbc/tasks.py
_update_workflow_stages
def _update_workflow_stages(stage_data: dict, workflow_stage: WorkflowStage, docker: DockerSwarmClient): """Check and update the status of a workflow stage. This function checks and updates the status of a workflow stage specified by the parameters in the specified stage_data di...
python
def _update_workflow_stages(stage_data: dict, workflow_stage: WorkflowStage, docker: DockerSwarmClient): """Check and update the status of a workflow stage. This function checks and updates the status of a workflow stage specified by the parameters in the specified stage_data di...
Check and update the status of a workflow stage. This function checks and updates the status of a workflow stage specified by the parameters in the specified stage_data dictionary. If the workflow stage is not marked as complete, this function will check with the Docker Swarm API on the status of Dock...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_block_controller/sip_pbc/tasks.py#L146-L187
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_block_controller/sip_pbc/tasks.py
_abort_workflow
def _abort_workflow(pb: ProcessingBlock, workflow_stage_dict: dict, docker: DockerSwarmClient): """Abort the workflow. TODO(BMo): This function currently does nothing as the abort flag is hardcoded to False! This function is used by `execute_processing_block`. Args: ...
python
def _abort_workflow(pb: ProcessingBlock, workflow_stage_dict: dict, docker: DockerSwarmClient): """Abort the workflow. TODO(BMo): This function currently does nothing as the abort flag is hardcoded to False! This function is used by `execute_processing_block`. Args: ...
Abort the workflow. TODO(BMo): This function currently does nothing as the abort flag is hardcoded to False! This function is used by `execute_processing_block`. Args: pb (ProcessingBlock): Configuration database Processing block object. workflow_stage_dict (dict): Workflow stage ...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_block_controller/sip_pbc/tasks.py#L190-L217
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_block_controller/sip_pbc/tasks.py
_workflow_complete
def _workflow_complete(workflow_stage_dict: dict): """Check if the workflow is complete. This function checks if the entire workflow is complete. This function is used by `execute_processing_block`. Args: workflow_stage_dict (dict): Workflow metadata dictionary. Returns: bool, Tr...
python
def _workflow_complete(workflow_stage_dict: dict): """Check if the workflow is complete. This function checks if the entire workflow is complete. This function is used by `execute_processing_block`. Args: workflow_stage_dict (dict): Workflow metadata dictionary. Returns: bool, Tr...
Check if the workflow is complete. This function checks if the entire workflow is complete. This function is used by `execute_processing_block`. Args: workflow_stage_dict (dict): Workflow metadata dictionary. Returns: bool, True if the workflow is complete, otherwise False.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_block_controller/sip_pbc/tasks.py#L220-L242
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_block_controller/sip_pbc/tasks.py
execute_processing_block
def execute_processing_block(pb_id: str, log_level='DEBUG'): """Execute a processing block. Celery tasks that executes a workflow defined in a Configuration database Processing Block data object. Args: pb_id (str): The PB id for the PBC log_level (str): Python logging level. """ ...
python
def execute_processing_block(pb_id: str, log_level='DEBUG'): """Execute a processing block. Celery tasks that executes a workflow defined in a Configuration database Processing Block data object. Args: pb_id (str): The PB id for the PBC log_level (str): Python logging level. """ ...
Execute a processing block. Celery tasks that executes a workflow defined in a Configuration database Processing Block data object. Args: pb_id (str): The PB id for the PBC log_level (str): Python logging level.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_block_controller/sip_pbc/tasks.py#L246-L303
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_controller/scheduler/pb_queue.py
ProcessingBlockQueue.put
def put(self, block_id, priority, pb_type='offline'): """Add a Processing Block to the queue. When a new entry it added, the queue is (re-)sorted by priority followed by insertion order (older blocks with equal priority are first). Args: block_id (str): Processing B...
python
def put(self, block_id, priority, pb_type='offline'): """Add a Processing Block to the queue. When a new entry it added, the queue is (re-)sorted by priority followed by insertion order (older blocks with equal priority are first). Args: block_id (str): Processing B...
Add a Processing Block to the queue. When a new entry it added, the queue is (re-)sorted by priority followed by insertion order (older blocks with equal priority are first). Args: block_id (str): Processing Block Identifier priority (int): Processing Block sche...
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/pb_queue.py#L34-L64
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_controller/scheduler/pb_queue.py
ProcessingBlockQueue.get
def get(self): """Get the highest priority Processing Block from the queue.""" with self._mutex: entry = self._queue.pop() del self._block_map[entry[2]] return entry[2]
python
def get(self): """Get the highest priority Processing Block from the queue.""" with self._mutex: entry = self._queue.pop() del self._block_map[entry[2]] return entry[2]
Get the highest priority Processing Block from the queue.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/pb_queue.py#L66-L71
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/processing_controller/scheduler/pb_queue.py
ProcessingBlockQueue.remove
def remove(self, block_id): """Remove a Processing Block from the queue. Args: block_id (str): """ with self._mutex: entry = self._block_map[block_id] self._queue.remove(entry)
python
def remove(self, block_id): """Remove a Processing Block from the queue. Args: block_id (str): """ with self._mutex: entry = self._block_map[block_id] self._queue.remove(entry)
Remove a Processing Block from the queue. Args: block_id (str):
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/pb_queue.py#L73-L81
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/states/services.py
get_service_state_list
def get_service_state_list() -> List[ServiceState]: """Return a list of ServiceState objects known to SDP.""" keys = DB.get_keys('states*') LOG.debug('Loading list of known services.') services = [] for key in keys: values = key.split(':') if len(values) == 4: services.ap...
python
def get_service_state_list() -> List[ServiceState]: """Return a list of ServiceState objects known to SDP.""" keys = DB.get_keys('states*') LOG.debug('Loading list of known services.') services = [] for key in keys: values = key.split(':') if len(values) == 4: services.ap...
Return a list of ServiceState objects known to SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/states/services.py#L11-L20
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/states/services.py
get_service_id_list
def get_service_id_list() -> List[tuple]: """Return list of Services.""" keys = DB.get_keys('states*') services = [] for key in keys: values = key.split(':') if len(values) == 4: services.append(':'.join(values[1:])) return services
python
def get_service_id_list() -> List[tuple]: """Return list of Services.""" keys = DB.get_keys('states*') services = [] for key in keys: values = key.split(':') if len(values) == 4: services.append(':'.join(values[1:])) return services
Return list of Services.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/states/services.py#L23-L31
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/api/processing_block_list.py
get
def get(): """Return the list of Processing Blocks known to SDP.""" LOG.debug('GET Processing Block list') _url = get_root_url() # Get list of Processing block Ids block_ids = sorted(DB.get_processing_block_ids()) LOG.debug('Processing Block IDs: %s', block_ids) # Construct response objec...
python
def get(): """Return the list of Processing Blocks known to SDP.""" LOG.debug('GET Processing Block list') _url = get_root_url() # Get list of Processing block Ids block_ids = sorted(DB.get_processing_block_ids()) LOG.debug('Processing Block IDs: %s', block_ids) # Construct response objec...
Return the list of Processing Blocks known to SDP.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/processing_block_list.py#L18-L46
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py
SchedulingObject.config
def config(self) -> dict: """Get the scheduling object config.""" # Check that the key exists self._check_object_exists() config_dict = DB.get_hash_dict(self.key) for _, value in config_dict.items(): for char in ['[', '{']: if char in value: ...
python
def config(self) -> dict: """Get the scheduling object config.""" # Check that the key exists self._check_object_exists() config_dict = DB.get_hash_dict(self.key) for _, value in config_dict.items(): for char in ['[', '{']: if char in value: ...
Get the scheduling object config.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py#L49-L58
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py
SchedulingObject.get_property
def get_property(self, property_key: str) -> str: """Get a scheduling object property.""" self._check_object_exists() return DB.get_hash_value(self.key, property_key)
python
def get_property(self, property_key: str) -> str: """Get a scheduling object property.""" self._check_object_exists() return DB.get_hash_value(self.key, property_key)
Get a scheduling object property.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py#L60-L63
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py
SchedulingObject.set_status
def set_status(self, value): """Set the status of the scheduling object.""" self._check_object_exists() DB.set_hash_value(self.key, 'status', value) self.publish('status_changed', event_data=dict(status=value))
python
def set_status(self, value): """Set the status of the scheduling object.""" self._check_object_exists() DB.set_hash_value(self.key, 'status', value) self.publish('status_changed', event_data=dict(status=value))
Set the status of the scheduling object.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py#L81-L85
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py
SchedulingObject.publish
def publish(self, event_type: str, event_data: dict = None): """Publish an event associated with the scheduling object. Note: Ideally publish should not be used directly but by other methods which perform actions on the object. Args: event_type (str): Type o...
python
def publish(self, event_type: str, event_data: dict = None): """Publish an event associated with the scheduling object. Note: Ideally publish should not be used directly but by other methods which perform actions on the object. Args: event_type (str): Type o...
Publish an event associated with the scheduling object. Note: Ideally publish should not be used directly but by other methods which perform actions on the object. Args: event_type (str): Type of event. event_data (dict, optional): Event data.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py#L117-L140
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py
SchedulingObject.get_events
def get_events(self) -> List[Event]: """Get events associated with the scheduling object. Returns: list of Event objects """ LOG.debug('Getting events for %s', self.key) return get_events(self.key)
python
def get_events(self) -> List[Event]: """Get events associated with the scheduling object. Returns: list of Event objects """ LOG.debug('Getting events for %s', self.key) return get_events(self.key)
Get events associated with the scheduling object. Returns: list of Event objects
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py#L142-L150
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py
SchedulingObject._check_object_exists
def _check_object_exists(self): """Raise a KeyError if the scheduling object doesnt exist. Raise: KeyError, if the object doesnt exist in the database. """ if not DB.get_keys(self.key): raise KeyError("Object with key '{}' not exist".format(self.key))
python
def _check_object_exists(self): """Raise a KeyError if the scheduling object doesnt exist. Raise: KeyError, if the object doesnt exist in the database. """ if not DB.get_keys(self.key): raise KeyError("Object with key '{}' not exist".format(self.key))
Raise a KeyError if the scheduling object doesnt exist. Raise: KeyError, if the object doesnt exist in the database.
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/_scheduling_object.py#L160-L168
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/states/service_state.py
ServiceState.get_service_state_object_id
def get_service_state_object_id(subsystem: str, name: str, version: str) -> str: """Return service state data object key. Args: subsystem (str): Subsystem the service belongs to name (str): Name of the Service version (str): Versio...
python
def get_service_state_object_id(subsystem: str, name: str, version: str) -> str: """Return service state data object key. Args: subsystem (str): Subsystem the service belongs to name (str): Name of the Service version (str): Versio...
Return service state data object key. Args: subsystem (str): Subsystem the service belongs to name (str): Name of the Service version (str): Version of the Service Returns: str, Key used to store the service state data object
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/states/service_state.py#L59-L72
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.create_services
def create_services(self, compose_str: str) -> list: """Create new docker services. Args: compose_str (string): Docker compose 'file' string Return: service_names, list """ # Raise an exception if we are not a manager if not self._manager: ...
python
def create_services(self, compose_str: str) -> list: """Create new docker services. Args: compose_str (string): Docker compose 'file' string Return: service_names, list """ # Raise an exception if we are not a manager if not self._manager: ...
Create new docker services. Args: compose_str (string): Docker compose 'file' string Return: service_names, list
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L88-L134
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.create_volume
def create_volume(self, volume_name: str, driver_spec: str = None): """Create new docker volumes. Only the manager nodes can create a volume Args: volume_name (string): Name for the new docker volume driver_spec (string): Driver for the docker volume """ ...
python
def create_volume(self, volume_name: str, driver_spec: str = None): """Create new docker volumes. Only the manager nodes can create a volume Args: volume_name (string): Name for the new docker volume driver_spec (string): Driver for the docker volume """ ...
Create new docker volumes. Only the manager nodes can create a volume Args: volume_name (string): Name for the new docker volume driver_spec (string): Driver for the docker volume
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L136-L156
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.delete_service
def delete_service(self, service: str): """Removes/stops a docker service. Only the manager nodes can delete a service Args: service (string): Service name or ID """ # Raise an exception if we are not a manager if not self._manager: raise Runtime...
python
def delete_service(self, service: str): """Removes/stops a docker service. Only the manager nodes can delete a service Args: service (string): Service name or ID """ # Raise an exception if we are not a manager if not self._manager: raise Runtime...
Removes/stops a docker service. Only the manager nodes can delete a service Args: service (string): Service name or ID
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L162-L176
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.delete_all_services
def delete_all_services(self): """Removes/stops a service. Only the manager nodes can delete a service """ # Raise an exception if we are not a manager if not self._manager: raise RuntimeError('Services can only be deleted ' 'on swarm m...
python
def delete_all_services(self): """Removes/stops a service. Only the manager nodes can delete a service """ # Raise an exception if we are not a manager if not self._manager: raise RuntimeError('Services can only be deleted ' 'on swarm m...
Removes/stops a service. Only the manager nodes can delete a service
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L178-L191
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.delete_volume
def delete_volume(self, volume_name: str): """Removes/stops a docker volume. Only the manager nodes can delete a volume Args: volume_name (string): Name of the volume """ # Raise an exception if we are not a manager if not self._manager: raise Ru...
python
def delete_volume(self, volume_name: str): """Removes/stops a docker volume. Only the manager nodes can delete a volume Args: volume_name (string): Name of the volume """ # Raise an exception if we are not a manager if not self._manager: raise Ru...
Removes/stops a docker volume. Only the manager nodes can delete a volume Args: volume_name (string): Name of the volume
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L193-L207
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.delete_all_volumes
def delete_all_volumes(self): """Remove all the volumes. Only the manager nodes can delete a volume """ # Raise an exception if we are not a manager if not self._manager: raise RuntimeError('Volumes can only be deleted ' 'on swarm manag...
python
def delete_all_volumes(self): """Remove all the volumes. Only the manager nodes can delete a volume """ # Raise an exception if we are not a manager if not self._manager: raise RuntimeError('Volumes can only be deleted ' 'on swarm manag...
Remove all the volumes. Only the manager nodes can delete a volume
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L209-L222
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_service_list
def get_service_list(self) -> list: """Get a list of docker services. Only the manager nodes can retrieve all the services Returns: list, all the ids of the services in swarm """ # Initialising empty list services = [] # Raise an exception if we ar...
python
def get_service_list(self) -> list: """Get a list of docker services. Only the manager nodes can retrieve all the services Returns: list, all the ids of the services in swarm """ # Initialising empty list services = [] # Raise an exception if we ar...
Get a list of docker services. Only the manager nodes can retrieve all the services Returns: list, all the ids of the services in swarm
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L228-L248
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_service_name
def get_service_name(self, service_id: str) -> str: """Get the name of the docker service. Only the manager nodes can retrieve service name Args: service_id (string): List of service ID Returns: string, name of the docker service """ # Raise an...
python
def get_service_name(self, service_id: str) -> str: """Get the name of the docker service. Only the manager nodes can retrieve service name Args: service_id (string): List of service ID Returns: string, name of the docker service """ # Raise an...
Get the name of the docker service. Only the manager nodes can retrieve service name Args: service_id (string): List of service ID Returns: string, name of the docker service
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L250-L268
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_service_details
def get_service_details(self, service_id: str) -> dict: """Get details of a service. Only the manager nodes can retrieve service details Args: service_id (string): List of service id Returns: dict, details of the service """ # Raise an exceptio...
python
def get_service_details(self, service_id: str) -> dict: """Get details of a service. Only the manager nodes can retrieve service details Args: service_id (string): List of service id Returns: dict, details of the service """ # Raise an exceptio...
Get details of a service. Only the manager nodes can retrieve service details Args: service_id (string): List of service id Returns: dict, details of the service
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L270-L288
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_service_state
def get_service_state(self, service_id: str) -> str: """Get the state of the service. Only the manager nodes can retrieve service state Args: service_id (str): Service id Returns: str, state of the service """ # Get service service = se...
python
def get_service_state(self, service_id: str) -> str: """Get the state of the service. Only the manager nodes can retrieve service state Args: service_id (str): Service id Returns: str, state of the service """ # Get service service = se...
Get the state of the service. Only the manager nodes can retrieve service state Args: service_id (str): Service id Returns: str, state of the service
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L290-L308
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_node_list
def get_node_list(self) -> list: """Get a list of nodes. Only the manager nodes can retrieve all the nodes Returns: list, all the ids of the nodes in swarm """ # Initialising empty list nodes = [] # Raise an exception if we are not a manager ...
python
def get_node_list(self) -> list: """Get a list of nodes. Only the manager nodes can retrieve all the nodes Returns: list, all the ids of the nodes in swarm """ # Initialising empty list nodes = [] # Raise an exception if we are not a manager ...
Get a list of nodes. Only the manager nodes can retrieve all the nodes Returns: list, all the ids of the nodes in swarm
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L310-L330
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_node_details
def get_node_details(self, node_id: list) -> dict: """Get details of a node. Only the manager nodes can retrieve details of a node Args: node_id (list): List of node ID Returns: dict, details of the node """ # Raise an exception if we are not a...
python
def get_node_details(self, node_id: list) -> dict: """Get details of a node. Only the manager nodes can retrieve details of a node Args: node_id (list): List of node ID Returns: dict, details of the node """ # Raise an exception if we are not a...
Get details of a node. Only the manager nodes can retrieve details of a node Args: node_id (list): List of node ID Returns: dict, details of the node
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L332-L350
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_container_list
def get_container_list(self) -> list: """Get list of containers. Returns: list, all the ids of containers """ # Initialising empty list containers = [] containers_list = self._client.containers.list() for c_list in containers_list: conta...
python
def get_container_list(self) -> list: """Get list of containers. Returns: list, all the ids of containers """ # Initialising empty list containers = [] containers_list = self._client.containers.list() for c_list in containers_list: conta...
Get list of containers. Returns: list, all the ids of containers
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L352-L365
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_container_details
def get_container_details(self, container_id_or_name: str) -> dict: """Get details of a container. Args: container_id_or_name (string): docker container id or name Returns: dict, details of the container """ container = self._client.containers.get(conta...
python
def get_container_details(self, container_id_or_name: str) -> dict: """Get details of a container. Args: container_id_or_name (string): docker container id or name Returns: dict, details of the container """ container = self._client.containers.get(conta...
Get details of a container. Args: container_id_or_name (string): docker container id or name Returns: dict, details of the container
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L367-L378
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_volume_list
def get_volume_list(self) -> list: """Get a list of docker volumes. Only the manager nodes can retrieve all the volumes Returns: list, all the names of the volumes in swarm """ # Initialising empty list volumes = [] # Raise an exception if we are n...
python
def get_volume_list(self) -> list: """Get a list of docker volumes. Only the manager nodes can retrieve all the volumes Returns: list, all the names of the volumes in swarm """ # Initialising empty list volumes = [] # Raise an exception if we are n...
Get a list of docker volumes. Only the manager nodes can retrieve all the volumes Returns: list, all the names of the volumes in swarm
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L380-L400
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_volume_details
def get_volume_details(self, volume_name: str) -> dict: """Get details of the volume. Args: volume_name (str): Name of the volume Returns: dict, details of the volume """ if volume_name not in self.volumes: raise RuntimeError('No such volume...
python
def get_volume_details(self, volume_name: str) -> dict: """Get details of the volume. Args: volume_name (str): Name of the volume Returns: dict, details of the volume """ if volume_name not in self.volumes: raise RuntimeError('No such volume...
Get details of the volume. Args: volume_name (str): Name of the volume Returns: dict, details of the volume
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L402-L416
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
DockerSwarmClient.get_actual_replica
def get_actual_replica(self, service_id: str) -> str: """Get the actual replica level of a service. Args: service_id (str): docker swarm service id Returns: str, replicated level of the service """ # Raise an exception if we are not a manager if...
python
def get_actual_replica(self, service_id: str) -> str: """Get the actual replica level of a service. Args: service_id (str): docker swarm service id Returns: str, replicated level of the service """ # Raise an exception if we are not a manager if...
Get the actual replica level of a service. Args: service_id (str): docker swarm service id Returns: str, replicated level of the service
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L418-L436