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_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
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...
[ "def", "processing_blocks", "(", "self", ")", ":", "sbi_ids", "=", "Subarray", "(", "self", ".", "get_name", "(", ")", ")", ".", "sbi_ids", "pbs", "=", "[", "]", "for", "sbi_id", "in", "sbi_ids", ":", "sbi", "=", "SchedulingBlockInstance", "(", "sbi_id",...
Return list of PBs associated with the subarray. <http://www.esrf.eu/computing/cs/tango/pytango/v920/server_api/server.html#PyTango.server.pipe>
[ "Return", "list", "of", "PBs", "associated", "with", "the", "subarray", "." ]
train
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')
[ "def", "datetime_from_isoformat", "(", "value", ":", "str", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "7", ")", ":", "return", "datetime", ".", "fromisoformat", "(", "value", ")", "return", "datetime", ".", "strptime", "(", "value"...
Return a datetime object from an isoformat string. Args: value (str): Datetime string in isoformat.
[ "Return", "a", "datetime", "object", "from", "an", "isoformat", "string", "." ]
train
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())
[ "def", "init_device", "(", "self", ")", ":", "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", "=", "D...
Device constructor.
[ "Device", "constructor", "." ]
train
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...
[ "def", "always_executed_hook", "(", "self", ")", ":", "_logT", "=", "self", ".", "_devProxy", ".", "get_logging_target", "(", ")", "if", "'device::sip_sdp_logger'", "not", "in", "_logT", ":", "try", ":", "self", ".", "_devProxy", ".", "add_logging_target", "("...
Run for each command.
[ "Run", "for", "each", "command", "." ]
train
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...
[ "def", "configure", "(", "self", ",", "value", ")", ":", "# 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\\'.'", ")"...
Schedule an offline only SBI with SDP.
[ "Schedule", "an", "offline", "only", "SBI", "with", "SDP", "." ]
train
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...
[ "def", "_get_service_state", "(", "service_id", ":", "str", ")", ":", "LOG", ".", "debug", "(", "'Getting state of service %s'", ",", "service_id", ")", "services", "=", "get_service_id_list", "(", ")", "service_ids", "=", "[", "s", "for", "s", "in", "services...
Get the Service state object for the specified id.
[ "Get", "the", "Service", "state", "object", "for", "the", "specified", "id", "." ]
train
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
[ "def", "get_current_service_state", "(", "self", ",", "service_id", ":", "str", ")", ":", "state", "=", "self", ".", "_get_service_state", "(", "service_id", ")", "return", "state", ".", "current_state" ]
Get the state of a SDP service.
[ "Get", "the", "state", "of", "a", "SDP", "service", "." ]
train
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
[ "def", "get_target_service_state", "(", "self", ",", "service_id", ":", "str", ")", ":", "state", "=", "self", ".", "_get_service_state", "(", "service_id", ")", "return", "state", ".", "target_state" ]
Get the state of a SDP service.
[ "Get", "the", "state", "of", "a", "SDP", "service", "." ]
train
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...
[ "def", "allowed_target_sdp_states", "(", "self", ")", ":", "_current_state", "=", "self", ".", "_sdp_state", ".", "current_state", "_allowed_target_states", "=", "self", ".", "_sdp_state", ".", "allowed_target_states", "[", "_current_state", "]", "return", "json", "...
Return a list of allowed target states for the current state.
[ "Return", "a", "list", "of", "allowed", "target", "states", "for", "the", "current", "state", "." ]
train
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...
[ "def", "target_sdp_state", "(", "self", ",", "state", ")", ":", "LOG", ".", "info", "(", "'Setting SDP target state to %s'", ",", "state", ")", "if", "self", ".", "_sdp_state", ".", "current_state", "==", "state", ":", "LOG", ".", "info", "(", "'Target state...
Update the target state of SDP.
[ "Update", "the", "target", "state", "of", "SDP", "." ]
train
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))))
[ "def", "health", "(", "self", ")", ":", "return", "json", ".", "dumps", "(", "dict", "(", "uptime", "=", "'{:.3f}s'", ".", "format", "(", "(", "time", ".", "time", "(", ")", "-", "self", ".", "_start_time", ")", ")", ")", ")" ]
Health check method, returns the up-time of the device.
[ "Health", "check", "method", "returns", "the", "up", "-", "time", "of", "the", "device", "." ]
train
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, ...
[ "def", "scheduling_block_instances", "(", "self", ")", ":", "# TODO(BMo) change this to a pipe?", "sbi_list", "=", "SchedulingBlockInstanceList", "(", ")", "return", "json", ".", "dumps", "(", "dict", "(", "active", "=", "sbi_list", ".", "active", ",", "completed", ...
Return the a JSON dict encoding the SBIs known to SDP.
[ "Return", "the", "a", "JSON", "dict", "encoding", "the", "SBIs", "known", "to", "SDP", "." ]
train
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, ...
[ "def", "processing_blocks", "(", "self", ")", ":", "pb_list", "=", "ProcessingBlockList", "(", ")", "# TODO(BMo) realtime, offline etc.", "return", "json", ".", "dumps", "(", "dict", "(", "active", "=", "pb_list", ".", "active", ",", "completed", "=", "pb_list",...
Return the a JSON dict encoding the PBs known to SDP.
[ "Return", "the", "a", "JSON", "dict", "encoding", "the", "PBs", "known", "to", "SDP", "." ]
train
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...
[ "def", "processing_block_devices", "(", "self", ")", ":", "# 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", "=...
Get list of processing block devices.
[ "Get", "list", "of", "processing", "block", "devices", "." ]
train
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_...
[ "def", "_set_master_state", "(", "self", ",", "state", ")", ":", "if", "state", "==", "'init'", ":", "self", ".", "_service_state", ".", "update_current_state", "(", "'init'", ",", "force", "=", "True", ")", "self", ".", "set_state", "(", "DevState", ".", ...
Set the state of the SDPMaster.
[ "Set", "the", "state", "of", "the", "SDPMaster", "." ]
train
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...
[ "def", "register_subarray_devices", "(", ")", ":", "tango_db", "=", "Database", "(", ")", "LOG", ".", "info", "(", "\"Registering Subarray devices:\"", ")", "device_info", "=", "DbDevInfo", "(", ")", "# pylint: disable=protected-access", "device_info", ".", "_class", ...
Register subarray devices.
[ "Register", "subarray", "devices", "." ]
train
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 ...
[ "def", "add_workflow_definitions", "(", "sbi_config", ":", "dict", ")", ":", "registered_workflows", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "sbi_config", "[", "'processing_blocks'", "]", ")", ")", ":", "workflow_config", "=", "sbi_config", ...
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.
[ "Add", "any", "missing", "SBI", "workflow", "definitions", "as", "placeholders", "." ]
train
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...
[ "def", "generate_version", "(", "max_major", ":", "int", "=", "1", ",", "max_minor", ":", "int", "=", "7", ",", "max_patch", ":", "int", "=", "15", ")", "->", "str", ":", "major", "=", "randint", "(", "0", ",", "max_major", ")", "minor", "=", "rand...
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
[ "Select", "a", "random", "version", "." ]
train
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...
[ "def", "generate_sb", "(", "date", ":", "datetime", ".", "datetime", ",", "project", ":", "str", ",", "programme_block", ":", "str", ")", "->", "dict", ":", "date", "=", "date", ".", "strftime", "(", "'%Y%m%d'", ")", "instance_id", "=", "randint", "(", ...
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.
[ "Generate", "a", "Scheduling", "Block", "data", "object", "." ]
train
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 ...
[ "def", "generate_pb_config", "(", "pb_id", ":", "str", ",", "pb_config", ":", "dict", "=", "None", ",", "workflow_config", ":", "dict", "=", "None", ")", "->", "dict", ":", "if", "workflow_config", "is", "None", ":", "workflow_config", "=", "dict", "(", ...
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.
[ "Generate", "a", "PB", "configuration", "dictionary", "." ]
train
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...
[ "def", "generate_sbi_config", "(", "num_pbs", ":", "int", "=", "3", ",", "project", ":", "str", "=", "'sip'", ",", "programme_block", ":", "str", "=", "'sip_demos'", ",", "pb_config", ":", "Union", "[", "dict", ",", "List", "[", "dict", "]", "]", "=", ...
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...
[ "Generate", "a", "SBI", "configuration", "dictionary", "." ]
train
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...
[ "def", "generate_sbi_json", "(", "num_pbs", ":", "int", "=", "3", ",", "project", ":", "str", "=", "'sip'", ",", "programme_block", ":", "str", "=", "'sip_demos'", ",", "pb_config", ":", "Union", "[", "dict", ",", "List", "[", "dict", "]", "]", "=", ...
Return a JSON string used to configure an SBI.
[ "Return", "a", "JSON", "string", "used", "to", "configure", "an", "SBI", "." ]
train
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 ...
[ "def", "log", "(", "self", ",", "argin", ")", ":", "#", "# 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", "# argin[4] = Not used - reserved", "# a...
Log a command for the SDP STango ubsystem devices.
[ "Log", "a", "command", "for", "the", "SDP", "STango", "ubsystem", "devices", "." ]
train
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...
[ "def", "get", "(", "block_id", ")", ":", "try", ":", "sbi_details", "=", "DB", ".", "get_block_details", "(", "[", "block_id", "]", ")", ".", "__next__", "(", ")", "sbi_details", "[", "'processing_blocks'", "]", "=", "[", "]", "pb_ids", "=", "sbi_details...
Scheduling block detail resource.
[ "Scheduling", "block", "detail", "resource", "." ]
train
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'] = { ...
[ "def", "delete", "(", "block_id", ")", ":", "_url", "=", "get_root_url", "(", ")", "LOG", ".", "debug", "(", "'Requested delete of SBI %s'", ",", "block_id", ")", "try", ":", "DB", ".", "delete_sched_block_instance", "(", "block_id", ")", "response", "=", "d...
Scheduling block detail resource.
[ "Scheduling", "block", "detail", "resource", "." ]
train
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_...
[ "def", "_scheduling_block_ids", "(", "num_blocks", ",", "start_id", ",", "project", ")", ":", "for", "i", "in", "range", "(", "num_blocks", ")", ":", "_root", "=", "'{}-{}'", ".", "format", "(", "strftime", "(", "\"%Y%m%d\"", ",", "gmtime", "(", ")", ")"...
Generate Scheduling Block instance ID
[ "Generate", "Scheduling", "Block", "instance", "ID" ]
train
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=_...
[ "def", "_generate_processing_blocks", "(", "start_id", ",", "min_blocks", "=", "0", ",", "max_blocks", "=", "4", ")", ":", "processing_blocks", "=", "[", "]", "num_blocks", "=", "random", ".", "randint", "(", "min_blocks", ",", "max_blocks", ")", "for", "i",...
Generate a number of Processing Blocks
[ "Generate", "a", "number", "of", "Processing", "Blocks" ]
train
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, ...
[ "def", "_scheduling_block_config", "(", "num_blocks", "=", "5", ",", "start_sbi_id", "=", "0", ",", "start_pb_id", "=", "0", ",", "project", "=", "'sip'", ")", ":", "pb_id", "=", "start_pb_id", "for", "sb_id", ",", "sbi_id", "in", "_scheduling_block_ids", "(...
Return a Scheduling Block Configuration dictionary
[ "Return", "a", "Scheduling", "Block", "Configuration", "dictionary" ]
train
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...
[ "def", "add_scheduling_blocks", "(", "num_blocks", ",", "clear", "=", "True", ")", ":", "db_client", "=", "ConfigDb", "(", ")", "if", "clear", ":", "LOG", ".", "info", "(", "'Resetting database ...'", ")", "db_client", ".", "clear", "(", ")", "start_sbi_id",...
Add a number of scheduling blocks to the db.
[ "Add", "a", "number", "of", "scheduling", "blocks", "to", "the", "db", "." ]
train
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('...
[ "def", "main", "(", ")", ":", "# Configure the logger", "log", "=", "logging", ".", "getLogger", "(", "'SIP.EC.PCI.DB'", ")", "handler", "=", "logging", ".", "StreamHandler", "(", ")", "handler", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "'...
Main function
[ "Main", "function" ]
train
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)
[ "def", "main", "(", "args", "=", "None", ",", "*", "*", "kwargs", ")", ":", "LOG", ".", "info", "(", "'Starting SDP PB devices.'", ")", "return", "run", "(", "[", "ProcessingBlockDevice", "]", ",", "verbose", "=", "True", ",", "msg_stream", "=", "sys", ...
Start the Processing Block device server.
[ "Start", "the", "Processing", "Block", "device", "server", "." ]
train
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(...
[ "def", "get_id", "(", "date", ":", "datetime", ".", "datetime", ")", "->", "str", ":", "date", "=", "date", ".", "strftime", "(", "'%Y%m%d'", ")", "return", "'PB-{}-{}-{:03d}'", ".", "format", "(", "date", ",", "'sip'", ",", "randint", "(", "0", ",", ...
Generate a Processing Block (PB) Instance ID. Args: date (datetime.datetime): UTC date of the PB Returns: str, Processing Block ID
[ "Generate", "a", "Processing", "Block", "(", "PB", ")", "Instance", "ID", "." ]
train
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...
[ "def", "dependencies", "(", "self", ")", "->", "List", "[", "Dependency", "]", ":", "dependencies_str", "=", "DB", ".", "get_hash_value", "(", "self", ".", "key", ",", "'dependencies'", ")", "dependencies", "=", "[", "]", "for", "dependency", "in", "ast", ...
Return the PB dependencies.
[ "Return", "the", "PB", "dependencies", "." ]
train
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...
[ "def", "resources_assigned", "(", "self", ")", "->", "List", "[", "Resource", "]", ":", "resources_str", "=", "DB", ".", "get_hash_value", "(", "self", ".", "key", ",", "'resources_assigned'", ")", "resources_assigned", "=", "[", "]", "for", "resource", "in"...
Return list of resources assigned to the PB.
[ "Return", "list", "of", "resources", "assigned", "to", "the", "PB", "." ]
train
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)))...
[ "def", "workflow_stages", "(", "self", ")", "->", "List", "[", "WorkflowStage", "]", ":", "workflow_stages", "=", "[", "]", "stages", "=", "DB", ".", "get_hash_value", "(", "self", ".", "key", ",", "'workflow_stages'", ")", "for", "index", "in", "range", ...
Return list of workflow stages. Returns: dict, resources of a specified pb
[ "Return", "list", "of", "workflow", "stages", "." ]
train
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...
[ "def", "add_assigned_resource", "(", "self", ",", "resource_type", ":", "str", ",", "value", ":", "Union", "[", "str", ",", "int", ",", "float", ",", "bool", "]", ",", "parameters", ":", "dict", "=", "None", ")", ":", "if", "parameters", "is", "None", ...
Add assigned resource to the processing block. Args: resource_type (str): Resource type value: Resource value parameters (dict, optional): Parameters specific to the resource
[ "Add", "assigned", "resource", "to", "the", "processing", "block", "." ]
train
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 ...
[ "def", "remove_assigned_resource", "(", "self", ",", "resource_type", ":", "str", ",", "value", ":", "Union", "[", "str", ",", "int", ",", "float", ",", "bool", "]", "=", "None", ",", "parameters", ":", "dict", "=", "None", ")", ":", "resources", "=", ...
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: ...
[ "Remove", "assigned", "resources", "from", "the", "processing", "block", "." ]
train
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...
[ "def", "abort", "(", "self", ")", ":", "LOG", ".", "debug", "(", "'Aborting PB %s'", ",", "self", ".", "_id", ")", "self", ".", "set_status", "(", "'aborted'", ")", "pb_type", "=", "DB", ".", "get_hash_value", "(", "self", ".", "key", ",", "'type'", ...
Abort the processing_block.
[ "Abort", "the", "processing_block", "." ]
train
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)
[ "def", "_mark_updated", "(", "self", ")", ":", "timestamp", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", ")", "DB", ".", "set_hash_value", "(", "self", ".", "key", ",", "'updated'", ",", "timestamp", ")" ]
Update the updated timestamp.
[ "Update", "the", "updated", "timestamp", "." ]
train
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...
[ "def", "get", "(", ")", ":", "_url", "=", "get_root_url", "(", ")", "LOG", ".", "debug", "(", "'GET Sub array list'", ")", "sub_array_ids", "=", "sorted", "(", "DB", ".", "get_sub_array_ids", "(", ")", ")", "response", "=", "dict", "(", "sub_arrays", "="...
Subarray list. This method will list all sub-arrays known to SDP.
[ "Subarray", "list", "." ]
train
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...
[ "def", "post", "(", ")", ":", "_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", "=", "{", "}", "D...
Generate a SBI.
[ "Generate", "a", "SBI", "." ]
train
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")
[ "def", "set_parameters", "(", "self", ",", "parameters_dict", ")", ":", "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
[ "Set", "the", "subarray", "parameters", "." ]
train
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'))
[ "def", "sbi_ids", "(", "self", ")", "->", "List", "[", "str", "]", ":", "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.
[ "Get", "the", "list", "of", "SBI", "Ids", "." ]
train
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: ...
[ "def", "configure_sbi", "(", "self", ",", "sbi_config", ":", "dict", ",", "schema_path", ":", "str", "=", "None", ")", ":", "if", "not", "self", ".", "active", ":", "raise", "RuntimeError", "(", "\"Unable to add SBIs to inactive subarray!\"", ")", "sbi_config", ...
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.
[ "Add", "a", "new", "SBI", "to", "the", "database", "associated", "with", "this", "subarray", "." ]
train
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')
[ "def", "abort", "(", "self", ")", ":", "for", "sbi_id", "in", "self", ".", "sbi_ids", ":", "sbi", "=", "SchedulingBlockInstance", "(", "sbi_id", ")", "sbi", ".", "abort", "(", ")", "self", ".", "set_state", "(", "'ABORTED'", ")" ]
Abort all SBIs associated with the subarray.
[ "Abort", "all", "SBIs", "associated", "with", "the", "subarray", "." ]
train
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', []) ...
[ "def", "deactivate", "(", "self", ")", ":", "DB", ".", "set_hash_value", "(", "self", ".", "_key", ",", "'active'", ",", "'False'", ")", "# Remove the subarray from each of the SBIs", "for", "sbi_id", "in", "self", ".", "sbi_ids", ":", "SchedulingBlockInstance", ...
Deactivate the subarray.
[ "Deactivate", "the", "subarray", "." ]
train
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)
[ "def", "remove_sbi_id", "(", "self", ",", "sbi_id", ")", ":", "sbi_ids", "=", "self", ".", "sbi_ids", "sbi_ids", ".", "remove", "(", "sbi_id", ")", "DB", ".", "set_hash_value", "(", "self", ".", "_key", ",", "'sbi_ids'", ",", "sbi_ids", ")" ]
Remove an SBI Identifier.
[ "Remove", "an", "SBI", "Identifier", "." ]
train
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)
[ "def", "_add_sbi_id", "(", "self", ",", "sbi_id", ")", ":", "sbi_ids", "=", "self", ".", "sbi_ids", "sbi_ids", ".", "append", "(", "sbi_id", ")", "DB", ".", "set_hash_value", "(", "self", ".", "_key", ",", "'sbi_ids'", ",", "sbi_ids", ")" ]
Add a SBI Identifier.
[ "Add", "a", "SBI", "Identifier", "." ]
train
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() ...
[ "def", "get", "(", "self", ")", "->", "Union", "[", "Event", ",", "None", "]", ":", "message", "=", "self", ".", "_queue", ".", "get_message", "(", ")", "if", "message", "and", "message", "[", "'type'", "]", "==", "'message'", ":", "event_id", "=", ...
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
[ "Get", "the", "latest", "event", "from", "the", "queue", "." ]
train
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...
[ "def", "get_published_events", "(", "self", ",", "process", "=", "True", ")", "->", "List", "[", "Event", "]", ":", "LOG", ".", "debug", "(", "'Getting published events (%s)'", ",", "self", ".", "_pub_key", ")", "if", "process", ":", "LOG", ".", "debug", ...
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...
[ "Get", "a", "list", "of", "published", "(", "pending", ")", "events", "." ]
train
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. ...
[ "def", "get_processed_events", "(", "self", ")", "->", "List", "[", "Event", "]", ":", "event_ids", "=", "DB", ".", "get_list", "(", "self", ".", "_processed_key", ")", "events", "=", "[", "]", "for", "event_id", "in", "event_ids", ":", "event_str", "=",...
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.
[ "Get", "all", "processed", "events", "." ]
train
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...
[ "def", "complete_event", "(", "self", ",", "event_id", ":", "str", ")", ":", "event_ids", "=", "DB", ".", "get_list", "(", "self", ".", "_processed_key", ")", "if", "event_id", "not", "in", "event_ids", ":", "raise", "KeyError", "(", "'Unable to complete eve...
Complete the specified event.
[ "Complete", "the", "specified", "event", "." ]
train
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 |...
[ "def", "add", "(", "workflow_definition", ":", "dict", ",", "templates_root", ":", "str", ")", ":", "schema_path", "=", "join", "(", "dirname", "(", "__file__", ")", ",", "'schema'", ",", "'workflow_definition.json'", ")", "with", "open", "(", "schema_path", ...
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...
[ "Add", "a", "workflow", "definition", "to", "the", "Configuration", "Database", "." ]
train
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...
[ "def", "register", "(", "workflow_id", ",", "workflow_version", ")", ":", "name", "=", "\"workflow_definitions:{}:{}\"", ".", "format", "(", "workflow_id", ",", "workflow_version", ")", "workflow_definition", "=", "dict", "(", "id", "=", "workflow_id", ",", "versi...
Register an (empty) workflow definition in the database.
[ "Register", "an", "(", "empty", ")", "workflow", "definition", "in", "the", "database", "." ]
train
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...
[ "def", "delete", "(", "workflow_id", ":", "str", "=", "None", ",", "workflow_version", ":", "str", "=", "None", ")", ":", "if", "workflow_id", "is", "None", "and", "workflow_version", "is", "None", ":", "keys", "=", "DB", ".", "get_keys", "(", "\"workflo...
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.
[ "Delete", "workflow", "definitions", "." ]
train
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 = "...
[ "def", "get_workflow", "(", "workflow_id", ":", "str", ",", "workflow_version", ":", "str", ")", "->", "dict", ":", "name", "=", "\"workflow_definitions:{}:{}\"", ".", "format", "(", "workflow_id", ",", "workflow_version", ")", "workflow", "=", "DB", ".", "get...
Get a workflow definition from the Configuration Database. Args: workflow_id (str): Workflow identifier workflow_version (str): Workflow version Returns: dict, Workflow definition dictionary
[ "Get", "a", "workflow", "definition", "from", "the", "Configuration", "Database", "." ]
train
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...
[ "def", "get_workflows", "(", ")", "->", "dict", ":", "keys", "=", "DB", ".", "get_keys", "(", "\"workflow_definitions:*\"", ")", "known_workflows", "=", "dict", "(", ")", "for", "key", "in", "keys", ":", "values", "=", "key", ".", "split", "(", "':'", ...
Get dict of ALL known workflow definitions. Returns list[dict]
[ "Get", "dict", "of", "ALL", "known", "workflow", "definitions", "." ]
train
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...
[ "def", "_load_templates", "(", "workflow", ":", "dict", ",", "templates_root", ":", "str", ")", ":", "workflow_template_path", "=", "join", "(", "templates_root", ",", "workflow", "[", "'id'", "]", ",", "workflow", "[", "'version'", "]", ")", "for", "i", "...
Load templates keys.
[ "Load", "templates", "keys", "." ]
train
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...
[ "def", "delete_pb_devices", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Register PB devices.'", ")", "parser", ".", "add_argument", "(", "'num_pb'", ",", "type", "=", "int", ",", "help", "=", "'Number of PBs device...
Delete PBs devices from the Tango database.
[ "Delete", "PBs", "devices", "from", "the", "Tango", "database", "." ]
train
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. #...
[ "def", "main", "(", ")", ":", "# 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", "("...
Main function for SPEAD sender module.
[ "Main", "function", "for", "SPEAD", "sender", "module", "." ]
train
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...
[ "def", "fill_buffer", "(", "heap_data", ",", "i_chan", ")", ":", "# Calculate the time count and fraction.", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "time_full", "=", "now", ".", "timestamp", "(", ")", "time_count", "=", "int", "(", ...
Blocking function to populate data in the heap. This is run in an executor.
[ "Blocking", "function", "to", "populate", "data", "in", "the", "heap", ".", "This", "is", "run", "in", "an", "executor", "." ]
train
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...
[ "async", "def", "_run_loop", "(", "self", ",", "executor", ")", ":", "# SPEAD heap descriptor.", "# One channel per stream and one time index per heap.", "max_duration_sec", "=", "self", ".", "_config", "[", "'max_duration_sec'", "]", "num_stations", "=", "self", ".", "...
Main loop.
[ "Main", "loop", "." ]
train
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()) ...
[ "def", "run", "(", "self", ")", ":", "# Create the thread pool.", "executor", "=", "concurrent", ".", "futures", ".", "ThreadPoolExecutor", "(", "max_workers", "=", "self", ".", "_config", "[", "'num_workers'", "]", ")", "# Wait to ensure multiple senders can be synch...
Starts the sender.
[ "Starts", "the", "sender", "." ]
train
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)
[ "def", "set_complete", "(", "self", ",", "object_id", ":", "str", ")", ":", "if", "object_id", "in", "self", ".", "active", ":", "DB", ".", "remove_from_list", "(", "'{}:active'", ".", "format", "(", "self", ".", "type", ")", ",", "object_id", ")", "DB...
Mark the specified object as completed.
[ "Mark", "the", "specified", "object", "as", "completed", "." ]
train
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. ""...
[ "def", "publish", "(", "self", ",", "object_id", ":", "str", ",", "event_type", ":", "str", ",", "event_data", ":", "dict", "=", "None", ")", ":", "object_key", "=", "SchedulingObject", ".", "get_key", "(", "self", ".", "type", ",", "object_id", ")", "...
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", "." ]
train
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...
[ "def", "_start_workflow_stages", "(", "pb", ":", "ProcessingBlock", ",", "pb_id", ":", "str", ",", "workflow_stage_dict", ":", "dict", ",", "workflow_stage", ":", "WorkflowStage", ",", "docker", ":", "DockerSwarmClient", ")", ":", "# FIXME(BMo) replace pb_id argument,...
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...
[ "Start", "a", "workflow", "stage", "by", "starting", "a", "number", "of", "docker", "services", "." ]
train
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...
[ "def", "_update_workflow_stages", "(", "stage_data", ":", "dict", ",", "workflow_stage", ":", "WorkflowStage", ",", "docker", ":", "DockerSwarmClient", ")", ":", "service_status_complete", "=", "[", "]", "# FIXME(BMo) is not \"complete\" -> is \"running\"", "if", "stage_d...
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...
[ "Check", "and", "update", "the", "status", "of", "a", "workflow", "stage", "." ]
train
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: ...
[ "def", "_abort_workflow", "(", "pb", ":", "ProcessingBlock", ",", "workflow_stage_dict", ":", "dict", ",", "docker", ":", "DockerSwarmClient", ")", ":", "# TODO(BMo) Ask the database if the abort flag on the PB is set.", "_abort_flag", "=", "False", "if", "_abort_flag", "...
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 ...
[ "Abort", "the", "workflow", "." ]
train
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...
[ "def", "_workflow_complete", "(", "workflow_stage_dict", ":", "dict", ")", ":", "# Check if all stages are complete, if so end the PBC by breaking", "# out of the while loop", "complete_stages", "=", "[", "]", "for", "_", ",", "stage_config", "in", "workflow_stage_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, True if the workflow is complete, otherwise False.
[ "Check", "if", "the", "workflow", "is", "complete", "." ]
train
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. """ ...
[ "def", "execute_processing_block", "(", "pb_id", ":", "str", ",", "log_level", "=", "'DEBUG'", ")", ":", "init_logger", "(", "'sip'", ",", "show_log_origin", "=", "True", ",", "propagate", "=", "False", ",", "log_level", "=", "log_level", ")", "LOG", ".", ...
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", "." ]
train
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...
[ "def", "put", "(", "self", ",", "block_id", ",", "priority", ",", "pb_type", "=", "'offline'", ")", ":", "if", "pb_type", "not", "in", "(", "'offline'", ",", "'realtime'", ")", ":", "raise", "ValueError", "(", "'Invalid PB type.'", ")", "with", "self", "...
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...
[ "Add", "a", "Processing", "Block", "to", "the", "queue", "." ]
train
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]
[ "def", "get", "(", "self", ")", ":", "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.
[ "Get", "the", "highest", "priority", "Processing", "Block", "from", "the", "queue", "." ]
train
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)
[ "def", "remove", "(", "self", ",", "block_id", ")", ":", "with", "self", ".", "_mutex", ":", "entry", "=", "self", ".", "_block_map", "[", "block_id", "]", "self", ".", "_queue", ".", "remove", "(", "entry", ")" ]
Remove a Processing Block from the queue. Args: block_id (str):
[ "Remove", "a", "Processing", "Block", "from", "the", "queue", "." ]
train
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...
[ "def", "get_service_state_list", "(", ")", "->", "List", "[", "ServiceState", "]", ":", "keys", "=", "DB", ".", "get_keys", "(", "'states*'", ")", "LOG", ".", "debug", "(", "'Loading list of known services.'", ")", "services", "=", "[", "]", "for", "key", ...
Return a list of ServiceState objects known to SDP.
[ "Return", "a", "list", "of", "ServiceState", "objects", "known", "to", "SDP", "." ]
train
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
[ "def", "get_service_id_list", "(", ")", "->", "List", "[", "tuple", "]", ":", "keys", "=", "DB", ".", "get_keys", "(", "'states*'", ")", "services", "=", "[", "]", "for", "key", "in", "keys", ":", "values", "=", "key", ".", "split", "(", "':'", ")"...
Return list of Services.
[ "Return", "list", "of", "Services", "." ]
train
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...
[ "def", "get", "(", ")", ":", "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", ...
Return the list of Processing Blocks known to SDP.
[ "Return", "the", "list", "of", "Processing", "Blocks", "known", "to", "SDP", "." ]
train
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: ...
[ "def", "config", "(", "self", ")", "->", "dict", ":", "# Check that the key exists", "self", ".", "_check_object_exists", "(", ")", "config_dict", "=", "DB", ".", "get_hash_dict", "(", "self", ".", "key", ")", "for", "_", ",", "value", "in", "config_dict", ...
Get the scheduling object config.
[ "Get", "the", "scheduling", "object", "config", "." ]
train
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)
[ "def", "get_property", "(", "self", ",", "property_key", ":", "str", ")", "->", "str", ":", "self", ".", "_check_object_exists", "(", ")", "return", "DB", ".", "get_hash_value", "(", "self", ".", "key", ",", "property_key", ")" ]
Get a scheduling object property.
[ "Get", "a", "scheduling", "object", "property", "." ]
train
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))
[ "def", "set_status", "(", "self", ",", "value", ")", ":", "self", ".", "_check_object_exists", "(", ")", "DB", ".", "set_hash_value", "(", "self", ".", "key", ",", "'status'", ",", "value", ")", "self", ".", "publish", "(", "'status_changed'", ",", "even...
Set the status of the scheduling object.
[ "Set", "the", "status", "of", "the", "scheduling", "object", "." ]
train
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...
[ "def", "publish", "(", "self", ",", "event_type", ":", "str", ",", "event_data", ":", "dict", "=", "None", ")", ":", "import", "inspect", "import", "os", ".", "path", "_stack", "=", "inspect", ".", "stack", "(", ")", "_origin", "=", "os", ".", "path"...
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.
[ "Publish", "an", "event", "associated", "with", "the", "scheduling", "object", "." ]
train
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)
[ "def", "get_events", "(", "self", ")", "->", "List", "[", "Event", "]", ":", "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
[ "Get", "events", "associated", "with", "the", "scheduling", "object", "." ]
train
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))
[ "def", "_check_object_exists", "(", "self", ")", ":", "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.
[ "Raise", "a", "KeyError", "if", "the", "scheduling", "object", "doesnt", "exist", "." ]
train
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...
[ "def", "get_service_state_object_id", "(", "subsystem", ":", "str", ",", "name", ":", "str", ",", "version", ":", "str", ")", "->", "str", ":", "return", "'{}:{}:{}'", ".", "format", "(", "subsystem", ",", "name", ",", "version", ")" ]
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
[ "Return", "service", "state", "data", "object", "key", "." ]
train
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: ...
[ "def", "create_services", "(", "self", ",", "compose_str", ":", "str", ")", "->", "list", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Services can only be run on '", "'swarm manager node...
Create new docker services. Args: compose_str (string): Docker compose 'file' string Return: service_names, list
[ "Create", "new", "docker", "services", "." ]
train
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 """ ...
[ "def", "create_volume", "(", "self", ",", "volume_name", ":", "str", ",", "driver_spec", ":", "str", "=", "None", ")", ":", "# Default values", "if", "driver_spec", ":", "driver", "=", "driver_spec", "else", ":", "driver", "=", "'local'", "# Raise an exception...
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", "." ]
train
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...
[ "def", "delete_service", "(", "self", ",", "service", ":", "str", ")", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Services can only be deleted '", "'on swarm manager nodes'", ")", "# Re...
Removes/stops a docker service. Only the manager nodes can delete a service Args: service (string): Service name or ID
[ "Removes", "/", "stops", "a", "docker", "service", "." ]
train
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...
[ "def", "delete_all_services", "(", "self", ")", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Services can only be deleted '", "'on swarm manager nodes'", ")", "service_list", "=", "self", "...
Removes/stops a service. Only the manager nodes can delete a service
[ "Removes", "/", "stops", "a", "service", "." ]
train
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...
[ "def", "delete_volume", "(", "self", ",", "volume_name", ":", "str", ")", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Volumes can only be deleted '", "'on swarm manager nodes'", ")", "# ...
Removes/stops a docker volume. Only the manager nodes can delete a volume Args: volume_name (string): Name of the volume
[ "Removes", "/", "stops", "a", "docker", "volume", "." ]
train
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...
[ "def", "delete_all_volumes", "(", "self", ")", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Volumes can only be deleted '", "'on swarm manager nodes'", ")", "volume_list", "=", "self", ".",...
Remove all the volumes. Only the manager nodes can delete a volume
[ "Remove", "all", "the", "volumes", "." ]
train
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...
[ "def", "get_service_list", "(", "self", ")", "->", "list", ":", "# Initialising empty list", "services", "=", "[", "]", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node...
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
[ "Get", "a", "list", "of", "docker", "services", "." ]
train
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...
[ "def", "get_service_name", "(", "self", ",", "service_id", ":", "str", ")", "->", "str", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node can retrieve all'", "' th...
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
[ "Get", "the", "name", "of", "the", "docker", "service", "." ]
train
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...
[ "def", "get_service_details", "(", "self", ",", "service_id", ":", "str", ")", "->", "dict", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node can retrieve all'", "...
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
[ "Get", "details", "of", "a", "service", "." ]
train
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...
[ "def", "get_service_state", "(", "self", ",", "service_id", ":", "str", ")", "->", "str", ":", "# Get service", "service", "=", "self", ".", "_client", ".", "services", ".", "get", "(", "service_id", ")", "# Get the state of the service", "for", "service_task", ...
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", "the", "state", "of", "the", "service", "." ]
train
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 ...
[ "def", "get_node_list", "(", "self", ")", "->", "list", ":", "# Initialising empty list", "nodes", "=", "[", "]", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node '", ...
Get a list of nodes. Only the manager nodes can retrieve all the nodes Returns: list, all the ids of the nodes in swarm
[ "Get", "a", "list", "of", "nodes", "." ]
train
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...
[ "def", "get_node_details", "(", "self", ",", "node_id", ":", "list", ")", "->", "dict", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node can '", "'retrieve node de...
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
[ "Get", "details", "of", "a", "node", "." ]
train
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...
[ "def", "get_container_list", "(", "self", ")", "->", "list", ":", "# Initialising empty list", "containers", "=", "[", "]", "containers_list", "=", "self", ".", "_client", ".", "containers", ".", "list", "(", ")", "for", "c_list", "in", "containers_list", ":",...
Get list of containers. Returns: list, all the ids of containers
[ "Get", "list", "of", "containers", "." ]
train
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...
[ "def", "get_container_details", "(", "self", ",", "container_id_or_name", ":", "str", ")", "->", "dict", ":", "container", "=", "self", ".", "_client", ".", "containers", ".", "get", "(", "container_id_or_name", ")", "return", "container", ".", "attrs" ]
Get details of a container. Args: container_id_or_name (string): docker container id or name Returns: dict, details of the container
[ "Get", "details", "of", "a", "container", "." ]
train
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...
[ "def", "get_volume_list", "(", "self", ")", "->", "list", ":", "# Initialising empty list", "volumes", "=", "[", "]", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node c...
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
[ "Get", "a", "list", "of", "docker", "volumes", "." ]
train
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...
[ "def", "get_volume_details", "(", "self", ",", "volume_name", ":", "str", ")", "->", "dict", ":", "if", "volume_name", "not", "in", "self", ".", "volumes", ":", "raise", "RuntimeError", "(", "'No such volume found: '", ",", "volume_name", ")", "volume", "=", ...
Get details of the volume. Args: volume_name (str): Name of the volume Returns: dict, details of the volume
[ "Get", "details", "of", "the", "volume", "." ]
train
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...
[ "def", "get_actual_replica", "(", "self", ",", "service_id", ":", "str", ")", "->", "str", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node can retrieve '", "'repl...
Get the actual replica level of a service. Args: service_id (str): docker swarm service id Returns: str, replicated level of the service
[ "Get", "the", "actual", "replica", "level", "of", "a", "service", "." ]
train
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L418-L436