repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient.get_replicas | def get_replicas(self, service_id: str) -> str:
"""Get the replication level of a service.
Args:
service_id (str): docker swarm service id
Returns:
str, replication level of the service
"""
# Initialising empty list
replicas = []
# Rais... | python | def get_replicas(self, service_id: str) -> str:
"""Get the replication level of a service.
Args:
service_id (str): docker swarm service id
Returns:
str, replication level of the service
"""
# Initialising empty list
replicas = []
# Rais... | Get the replication level of a service.
Args:
service_id (str): docker swarm service id
Returns:
str, replication level of the service | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L438-L460 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient.update_labels | def update_labels(self, node_name: str, labels: dict):
"""Update label of a node.
Args:
node_name (string): Name of the node.
labels (dict): Label to add to the node
"""
# Raise an exception if we are not a manager
if not self._manager:
raise ... | python | def update_labels(self, node_name: str, labels: dict):
"""Update label of a node.
Args:
node_name (string): Name of the node.
labels (dict): Label to add to the node
"""
# Raise an exception if we are not a manager
if not self._manager:
raise ... | Update label of a node.
Args:
node_name (string): Name of the node.
labels (dict): Label to add to the node | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L466-L484 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_services | def _parse_services(self, service_config: dict, service_name: str,
service_list: dict) -> dict:
"""Parse the docker compose file.
Args:
service_config (dict): Service configurations from the compose file
service_name (string): Name of the services
... | python | def _parse_services(self, service_config: dict, service_name: str,
service_list: dict) -> dict:
"""Parse the docker compose file.
Args:
service_config (dict): Service configurations from the compose file
service_name (string): Name of the services
... | Parse the docker compose file.
Args:
service_config (dict): Service configurations from the compose file
service_name (string): Name of the services
service_list (dict): Service configuration list
Returns:
dict, service specifications extracted from the ... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L490-L531 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_deploy | def _parse_deploy(self, deploy_values: dict, service_config: dict):
"""Parse deploy key.
Args:
deploy_values (dict): deploy configuration values
service_config (dict): Service configuration
"""
# Initialising empty dictionary
mode = {}
for d_valu... | python | def _parse_deploy(self, deploy_values: dict, service_config: dict):
"""Parse deploy key.
Args:
deploy_values (dict): deploy configuration values
service_config (dict): Service configuration
"""
# Initialising empty dictionary
mode = {}
for d_valu... | Parse deploy key.
Args:
deploy_values (dict): deploy configuration values
service_config (dict): Service configuration | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L533-L563 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_ports | def _parse_ports(port_values: dict) -> dict:
"""Parse ports key.
Args:
port_values (dict): ports configuration values
Returns:
dict, Ports specification which contains exposed ports
"""
# Initialising empty dictionary
endpoints = {}
for... | python | def _parse_ports(port_values: dict) -> dict:
"""Parse ports key.
Args:
port_values (dict): ports configuration values
Returns:
dict, Ports specification which contains exposed ports
"""
# Initialising empty dictionary
endpoints = {}
for... | Parse ports key.
Args:
port_values (dict): ports configuration values
Returns:
dict, Ports specification which contains exposed ports | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L570-L590 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_volumes | def _parse_volumes(volume_values: dict) -> str:
"""Parse volumes key.
Args:
volume_values (dict): volume configuration values
Returns:
string, volume specification with mount source and container path
"""
for v_values in volume_values:
for v... | python | def _parse_volumes(volume_values: dict) -> str:
"""Parse volumes key.
Args:
volume_values (dict): volume configuration values
Returns:
string, volume specification with mount source and container path
"""
for v_values in volume_values:
for v... | Parse volumes key.
Args:
volume_values (dict): volume configuration values
Returns:
string, volume specification with mount source and container path | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L593-L614 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_resources | def _parse_resources(resource_values: dict, resource_name: str) -> dict:
"""Parse resources key.
Args:
resource_values (dict): resource configurations values
resource_name (string): Resource name
Returns:
dict, resources specification
"""
# ... | python | def _parse_resources(resource_values: dict, resource_name: str) -> dict:
"""Parse resources key.
Args:
resource_values (dict): resource configurations values
resource_name (string): Resource name
Returns:
dict, resources specification
"""
# ... | Parse resources key.
Args:
resource_values (dict): resource configurations values
resource_name (string): Resource name
Returns:
dict, resources specification | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L617-L645 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_networks | def _parse_networks(service_list: dict) -> list:
"""Parse network key.
Args:
service_list (dict): Service configurations
Returns:
list, List of networks
"""
# Initialising empty list
networks = []
for n_values in service_list['networks'... | python | def _parse_networks(service_list: dict) -> list:
"""Parse network key.
Args:
service_list (dict): Service configurations
Returns:
list, List of networks
"""
# Initialising empty list
networks = []
for n_values in service_list['networks'... | Parse network key.
Args:
service_list (dict): Service configurations
Returns:
list, List of networks | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L648-L665 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py | DockerSwarmClient._parse_logging | def _parse_logging(log_values: dict, service_config: dict):
"""Parse log key.
Args:
log_values (dict): logging configuration values
service_config (dict): Service specification
"""
for log_key, log_value in log_values.items():
if 'driver' in log_key:
... | python | def _parse_logging(log_values: dict, service_config: dict):
"""Parse log key.
Args:
log_values (dict): logging configuration values
service_config (dict): Service specification
"""
for log_key, log_value in log_values.items():
if 'driver' in log_key:
... | Parse log key.
Args:
log_values (dict): logging configuration values
service_config (dict): Service specification | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L668-L679 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_controller/scheduler/scheduler.py | ProcessingBlockScheduler._init_queue | def _init_queue():
"""Initialise the Processing Block queue from the database.
This method should populate the queue from the current state of the
Configuration Database.
This needs to be based on the current set of Processing Blocks in
the database and consider events on these... | python | def _init_queue():
"""Initialise the Processing Block queue from the database.
This method should populate the queue from the current state of the
Configuration Database.
This needs to be based on the current set of Processing Blocks in
the database and consider events on these... | Initialise the Processing Block queue from the database.
This method should populate the queue from the current state of the
Configuration Database.
This needs to be based on the current set of Processing Blocks in
the database and consider events on these processing blocks. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/scheduler.py#L44-L60 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_controller/scheduler/scheduler.py | ProcessingBlockScheduler._monitor_events | def _monitor_events(self):
"""Watch for Processing Block events."""
LOG.info("Starting to monitor PB events")
check_counter = 0
while True:
if check_counter == 50:
check_counter = 0
LOG.debug('Checking for PB events...')
published_... | python | def _monitor_events(self):
"""Watch for Processing Block events."""
LOG.info("Starting to monitor PB events")
check_counter = 0
while True:
if check_counter == 50:
check_counter = 0
LOG.debug('Checking for PB events...')
published_... | Watch for Processing Block events. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/scheduler.py#L66-L97 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_controller/scheduler/scheduler.py | ProcessingBlockScheduler._processing_controller_status | def _processing_controller_status(self):
"""Report on the status of the Processing Block queue(s)."""
LOG.info('Starting Processing Block queue reporter.')
while True:
LOG.info('PB queue length = %d', len(self._queue))
time.sleep(self._report_interval)
if acti... | python | def _processing_controller_status(self):
"""Report on the status of the Processing Block queue(s)."""
LOG.info('Starting Processing Block queue reporter.')
while True:
LOG.info('PB queue length = %d', len(self._queue))
time.sleep(self._report_interval)
if acti... | Report on the status of the Processing Block queue(s). | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/scheduler.py#L99-L108 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_controller/scheduler/scheduler.py | ProcessingBlockScheduler._schedule_processing_blocks | def _schedule_processing_blocks(self):
"""Schedule Processing Blocks for execution."""
LOG.info('Starting to Schedule Processing Blocks.')
while True:
time.sleep(0.5)
if not self._queue:
continue
if self._num_pbcs >= self._max_pbcs:
... | python | def _schedule_processing_blocks(self):
"""Schedule Processing Blocks for execution."""
LOG.info('Starting to Schedule Processing Blocks.')
while True:
time.sleep(0.5)
if not self._queue:
continue
if self._num_pbcs >= self._max_pbcs:
... | Schedule Processing Blocks for execution. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/scheduler.py#L110-L135 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_controller/scheduler/scheduler.py | ProcessingBlockScheduler._monitor_pbc_status | def _monitor_pbc_status(self):
"""Monitor the PBC status."""
LOG.info('Starting to Monitor PBC status.')
inspect = celery.current_app.control.inspect()
workers = inspect.ping()
start_time = time.time()
while workers is None:
time.sleep(0.1)
elapsed... | python | def _monitor_pbc_status(self):
"""Monitor the PBC status."""
LOG.info('Starting to Monitor PBC status.')
inspect = celery.current_app.control.inspect()
workers = inspect.ping()
start_time = time.time()
while workers is None:
time.sleep(0.1)
elapsed... | Monitor the PBC status. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/scheduler.py#L137-L171 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/processing_controller/scheduler/scheduler.py | ProcessingBlockScheduler.start | def start(self):
"""Start the scheduler threads."""
# TODO(BMo) having this check is probably a good idea but I've \
# disabled it for now while the PBC is in flux.
# assert sip_pbc.release.__version__ == '1.2.3'
scheduler_threads = [
Thread(target=self._monitor_even... | python | def start(self):
"""Start the scheduler threads."""
# TODO(BMo) having this check is probably a good idea but I've \
# disabled it for now while the PBC is in flux.
# assert sip_pbc.release.__version__ == '1.2.3'
scheduler_threads = [
Thread(target=self._monitor_even... | Start the scheduler threads. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/processing_controller/scheduler/scheduler.py#L173-L196 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/alarms/prometheus/alarm_receiver/app/app.py | alarm | def alarm():
"""."""
if request.method == 'POST':
response = {'message': 'POST Accepted'}
logging.info('alarm POSTED!')
data = request.data
logging.info(data)
string = json.dumps(data)
producer.send('SIP-alarms', string.encode())
return response
return... | python | def alarm():
"""."""
if request.method == 'POST':
response = {'message': 'POST Accepted'}
logging.info('alarm POSTED!')
data = request.data
logging.info(data)
string = json.dumps(data)
producer.send('SIP-alarms', string.encode())
return response
return... | . | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/alarms/prometheus/alarm_receiver/app/app.py#L34-L44 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _update_service_current_state | def _update_service_current_state(service: ServiceState):
"""Update the current state of a service.
Updates the current state of services after their target state has changed.
Args:
service (ServiceState): Service state object to update
"""
LOG.debug("Setting current state from target sta... | python | def _update_service_current_state(service: ServiceState):
"""Update the current state of a service.
Updates the current state of services after their target state has changed.
Args:
service (ServiceState): Service state object to update
"""
LOG.debug("Setting current state from target sta... | Update the current state of a service.
Updates the current state of services after their target state has changed.
Args:
service (ServiceState): Service state object to update | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L28-L38 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _update_services_instant_gratification | def _update_services_instant_gratification(sdp_target_state: str):
"""For demonstration purposes only.
This instantly updates the services current state with the
target state, rather than wait on them or schedule random delays
in bringing them back up.
"""
service_states = get_service_state_lis... | python | def _update_services_instant_gratification(sdp_target_state: str):
"""For demonstration purposes only.
This instantly updates the services current state with the
target state, rather than wait on them or schedule random delays
in bringing them back up.
"""
service_states = get_service_state_lis... | For demonstration purposes only.
This instantly updates the services current state with the
target state, rather than wait on them or schedule random delays
in bringing them back up. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L41-L55 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _update_services_target_state | def _update_services_target_state(sdp_target_state: str):
"""Update the target states of services based on SDP target state.
When we get a new target state this function is called to ensure
components receive the target state(s) and/or act on them.
Args:
sdp_target_state (str): Target state of... | python | def _update_services_target_state(sdp_target_state: str):
"""Update the target states of services based on SDP target state.
When we get a new target state this function is called to ensure
components receive the target state(s) and/or act on them.
Args:
sdp_target_state (str): Target state of... | Update the target states of services based on SDP target state.
When we get a new target state this function is called to ensure
components receive the target state(s) and/or act on them.
Args:
sdp_target_state (str): Target state of SDP | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L60-L77 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _handle_sdp_target_state_updated | def _handle_sdp_target_state_updated(sdp_state: SDPState):
"""Respond to an SDP target state change event.
This function sets the current state of SDP to the target state if that is
possible.
TODO(BMo) This cant be done as a blocking function as it is here!
"""
LOG.info('Handling SDP target st... | python | def _handle_sdp_target_state_updated(sdp_state: SDPState):
"""Respond to an SDP target state change event.
This function sets the current state of SDP to the target state if that is
possible.
TODO(BMo) This cant be done as a blocking function as it is here!
"""
LOG.info('Handling SDP target st... | Respond to an SDP target state change event.
This function sets the current state of SDP to the target state if that is
possible.
TODO(BMo) This cant be done as a blocking function as it is here! | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L85-L103 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _parse_args | def _parse_args():
"""Command line parser."""
parser = argparse.ArgumentParser(description='{} service.'.
format(__service_id__))
parser.add_argument('--random_errors', action='store_true',
help='Enable random errors')
parser.add_argument('-v'... | python | def _parse_args():
"""Command line parser."""
parser = argparse.ArgumentParser(description='{} service.'.
format(__service_id__))
parser.add_argument('--random_errors', action='store_true',
help='Enable random errors')
parser.add_argument('-v'... | Command line parser. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L106-L124 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _init | def _init(sdp_state: SDPState):
"""Initialise the Master Controller Service.
Performs the following actions:
1. Registers ServiceState objects into the Config Db.
2. If initialising for the first time (unknown state),
sets the SDPState to 'init'
3. Initialises the state of Services, if runni... | python | def _init(sdp_state: SDPState):
"""Initialise the Master Controller Service.
Performs the following actions:
1. Registers ServiceState objects into the Config Db.
2. If initialising for the first time (unknown state),
sets the SDPState to 'init'
3. Initialises the state of Services, if runni... | Initialise the Master Controller Service.
Performs the following actions:
1. Registers ServiceState objects into the Config Db.
2. If initialising for the first time (unknown state),
sets the SDPState to 'init'
3. Initialises the state of Services, if running for the first time
(their sta... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L127-L213 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _process_event | def _process_event(event: Event, sdp_state: SDPState,
service_states: List[ServiceState]):
"""Process a SDP state change event."""
LOG.debug('Event detected! (id : "%s", type: "%s", data: "%s")',
event.object_id, event.type, event.data)
if event.object_id == 'SDP' and event... | python | def _process_event(event: Event, sdp_state: SDPState,
service_states: List[ServiceState]):
"""Process a SDP state change event."""
LOG.debug('Event detected! (id : "%s", type: "%s", data: "%s")',
event.object_id, event.type, event.data)
if event.object_id == 'SDP' and event... | Process a SDP state change event. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L216-L271 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | _process_state_change_events | def _process_state_change_events():
"""Process events relating to the overall state of SDP.
This function starts and event loop which continually checks for
and responds to SDP state change events.
"""
sdp_state = SDPState()
service_states = get_service_state_list()
state_events = sdp_state... | python | def _process_state_change_events():
"""Process events relating to the overall state of SDP.
This function starts and event loop which continually checks for
and responds to SDP state change events.
"""
sdp_state = SDPState()
service_states = get_service_state_list()
state_events = sdp_state... | Process events relating to the overall state of SDP.
This function starts and event loop which continually checks for
and responds to SDP state change events. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L278-L309 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/app/__main__.py | main | def main():
"""Merge temp_main and main."""
# Parse command line args.
_parse_args()
LOG.info("Starting: %s", __service_id__)
# Subscribe to state change events.
# FIXME(BMo) This API is unfortunate as it looks like we are only
# subscribing to sdp_state events.
LOG.info('Subscribing to... | python | def main():
"""Merge temp_main and main."""
# Parse command line args.
_parse_args()
LOG.info("Starting: %s", __service_id__)
# Subscribe to state change events.
# FIXME(BMo) This API is unfortunate as it looks like we are only
# subscribing to sdp_state events.
LOG.info('Subscribing to... | Merge temp_main and main. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/app/__main__.py#L312-L340 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ingest_visibilities/recv_c/send.py | main | def main():
"""Runs the test sender."""
stream_config = spead2.send.StreamConfig(
max_packet_size=16356, rate=1000e6, burst_size=10, max_heaps=1)
item_group = spead2.send.ItemGroup(flavour=spead2.Flavour(4, 64, 48, 0))
# Add item descriptors to the heap.
num_baselines = (512 * 513) // 2
... | python | def main():
"""Runs the test sender."""
stream_config = spead2.send.StreamConfig(
max_packet_size=16356, rate=1000e6, burst_size=10, max_heaps=1)
item_group = spead2.send.ItemGroup(flavour=spead2.Flavour(4, 64, 48, 0))
# Add item descriptors to the heap.
num_baselines = (512 * 513) // 2
... | Runs the test sender. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/recv_c/send.py#L11-L69 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_events/event.py | Event.from_config | def from_config(cls, config: dict):
"""Create an event object from an event dictionary object.
Args:
config (dict): Event Configuration dictionary.
"""
timestamp = config.get('timestamp', None)
return cls(config.get('id'),
config.get('type'),
... | python | def from_config(cls, config: dict):
"""Create an event object from an event dictionary object.
Args:
config (dict): Event Configuration dictionary.
"""
timestamp = config.get('timestamp', None)
return cls(config.get('id'),
config.get('type'),
... | Create an event object from an event dictionary object.
Args:
config (dict): Event Configuration dictionary. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_events/event.py#L45-L60 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/example_imager_mpi/example_mpi_imager.py | process_input_data | def process_input_data(filename, imager, grid_data, grid_norm, grid_weights):
"""Reads visibility data from a Measurement Set.
The visibility grid or weights grid is updated accordingly.
Visibility data are read from disk in blocks of size num_baselines.
Args:
filename (str): ... | python | def process_input_data(filename, imager, grid_data, grid_norm, grid_weights):
"""Reads visibility data from a Measurement Set.
The visibility grid or weights grid is updated accordingly.
Visibility data are read from disk in blocks of size num_baselines.
Args:
filename (str): ... | Reads visibility data from a Measurement Set.
The visibility grid or weights grid is updated accordingly.
Visibility data are read from disk in blocks of size num_baselines.
Args:
filename (str): Name of Measurement Set to open.
imager (oskar.Imager): Handle... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/example_imager_mpi/example_mpi_imager.py#L34-L93 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/example_imager_mpi/example_mpi_imager.py | main | def main():
"""Runs test imaging pipeline using MPI."""
# Check command line arguments.
if len(sys.argv) < 2:
raise RuntimeError(
'Usage: mpiexec -n <np> '
'python mpi_imager_test.py <settings_file> <dir>')
# Get the MPI communicator and initialise broadcast variables.
... | python | def main():
"""Runs test imaging pipeline using MPI."""
# Check command line arguments.
if len(sys.argv) < 2:
raise RuntimeError(
'Usage: mpiexec -n <np> '
'python mpi_imager_test.py <settings_file> <dir>')
# Get the MPI communicator and initialise broadcast variables.
... | Runs test imaging pipeline using MPI. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/example_imager_mpi/example_mpi_imager.py#L130-L248 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/scheduling_block_list.py | get | def get():
"""Return list of Scheduling Blocks Instances known to SDP ."""
LOG.debug('GET list of SBIs.')
# Construct response object.
_url = get_root_url()
response = dict(scheduling_blocks=[],
links=dict(home='{}'.format(_url)))
# Get ordered list of SBI ID's.
block_i... | python | def get():
"""Return list of Scheduling Blocks Instances known to SDP ."""
LOG.debug('GET list of SBIs.')
# Construct response object.
_url = get_root_url()
response = dict(scheduling_blocks=[],
links=dict(home='{}'.format(_url)))
# Get ordered list of SBI ID's.
block_i... | Return list of Scheduling Blocks Instances known to SDP . | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/scheduling_block_list.py#L20-L51 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/scheduling_block_list.py | get_table | def get_table():
"""Provides table of scheduling block instance metadata for use with AJAX
tables"""
response = dict(blocks=[])
block_ids = DB.get_sched_block_instance_ids()
for index, block_id in enumerate(block_ids):
block = DB.get_block_details([block_id]).__next__()
info = [
... | python | def get_table():
"""Provides table of scheduling block instance metadata for use with AJAX
tables"""
response = dict(blocks=[])
block_ids = DB.get_sched_block_instance_ids()
for index, block_id in enumerate(block_ids):
block = DB.get_block_details([block_id]).__next__()
info = [
... | Provides table of scheduling block instance metadata for use with AJAX
tables | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/scheduling_block_list.py#L64-L78 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/old.db/config_db_redis.py | ConfigDB.set_value | def set_value(self, key, field, value):
"""Add the state of the key and field"""
self._db.hset(key, field, value) | python | def set_value(self, key, field, value):
"""Add the state of the key and field"""
self._db.hset(key, field, value) | Add the state of the key and field | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/config_db_redis.py#L49-L51 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/old.db/config_db_redis.py | ConfigDB.push_event | def push_event(self, event_name, event_type, block_id):
"""Push inserts all the specified values at the tail of the list
stored at the key"""
self._db.rpush(event_name, dict(type=event_type, id=block_id)) | python | def push_event(self, event_name, event_type, block_id):
"""Push inserts all the specified values at the tail of the list
stored at the key"""
self._db.rpush(event_name, dict(type=event_type, id=block_id)) | Push inserts all the specified values at the tail of the list
stored at the key | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/config_db_redis.py#L98-L101 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/receive_pss/pulsar_search_task.py | main | def main():
"""Task run method."""
# Install handler to respond to SIGTERM
signal.signal(signal.SIGTERM, _sig_handler)
with open(sys.argv[1]) as fh:
config = json.load(fh)
# Starts the pulsar search ftp server
os.chdir(os.path.expanduser('~'))
receiver = PulsarStart(config, logging... | python | def main():
"""Task run method."""
# Install handler to respond to SIGTERM
signal.signal(signal.SIGTERM, _sig_handler)
with open(sys.argv[1]) as fh:
config = json.load(fh)
# Starts the pulsar search ftp server
os.chdir(os.path.expanduser('~'))
receiver = PulsarStart(config, logging... | Task run method. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/receive_pss/pulsar_search_task.py#L22-L33 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | check_connection | def check_connection(func):
"""Check connection exceptions."""
@wraps(func)
def with_exception_handling(*args, **kwargs):
"""Wrap function being decorated."""
try:
return func(*args, **kwargs)
except redis.exceptions.ConnectionError:
raise ConnectionError("Una... | python | def check_connection(func):
"""Check connection exceptions."""
@wraps(func)
def with_exception_handling(*args, **kwargs):
"""Wrap function being decorated."""
try:
return func(*args, **kwargs)
except redis.exceptions.ConnectionError:
raise ConnectionError("Una... | Check connection exceptions. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L19-L32 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.save_dict | def save_dict(self, key: str, my_dict: dict, hierarchical: bool = False):
"""Store the specified dictionary at the specified key."""
for _key, _value in my_dict.items():
if isinstance(_value, dict):
if not hierarchical:
self._db.hmset(key, {_key: json.dump... | python | def save_dict(self, key: str, my_dict: dict, hierarchical: bool = False):
"""Store the specified dictionary at the specified key."""
for _key, _value in my_dict.items():
if isinstance(_value, dict):
if not hierarchical:
self._db.hmset(key, {_key: json.dump... | Store the specified dictionary at the specified key. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L74-L91 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb._build_dict | def _build_dict(my_dict, keys, values):
"""Build a dictionary from a set of redis hashes.
keys = ['a', 'b', 'c']
values = {'value': 'foo'}
my_dict = {'a': {'b': {'c': {'value': 'foo'}}}}
Args:
my_dict (dict): Dictionary to add to
keys (list[s... | python | def _build_dict(my_dict, keys, values):
"""Build a dictionary from a set of redis hashes.
keys = ['a', 'b', 'c']
values = {'value': 'foo'}
my_dict = {'a': {'b': {'c': {'value': 'foo'}}}}
Args:
my_dict (dict): Dictionary to add to
keys (list[s... | Build a dictionary from a set of redis hashes.
keys = ['a', 'b', 'c']
values = {'value': 'foo'}
my_dict = {'a': {'b': {'c': {'value': 'foo'}}}}
Args:
my_dict (dict): Dictionary to add to
keys (list[str]): List of keys used to define hierarchy in my_d... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L94-L122 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb._load_values | def _load_values(self, db_key: str) -> dict:
"""Load values from the db at the specified key, db_key.
FIXME(BMo): Could also be extended to load scalar types (instead of
just list and hash)
"""
if self._db.type(db_key) == 'list':
db_values = self._db.lra... | python | def _load_values(self, db_key: str) -> dict:
"""Load values from the db at the specified key, db_key.
FIXME(BMo): Could also be extended to load scalar types (instead of
just list and hash)
"""
if self._db.type(db_key) == 'list':
db_values = self._db.lra... | Load values from the db at the specified key, db_key.
FIXME(BMo): Could also be extended to load scalar types (instead of
just list and hash) | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L124-L149 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb._load_dict_hierarchical | def _load_dict_hierarchical(self, db_key: str) -> dict:
"""Load a dictionary stored hierarchically at db_key."""
db_keys = self._db.keys(pattern=db_key + '*')
my_dict = {}
for _db_key in db_keys:
if self._db.type(_db_key) == 'list':
db_values = self._db.lrange... | python | def _load_dict_hierarchical(self, db_key: str) -> dict:
"""Load a dictionary stored hierarchically at db_key."""
db_keys = self._db.keys(pattern=db_key + '*')
my_dict = {}
for _db_key in db_keys:
if self._db.type(_db_key) == 'list':
db_values = self._db.lrange... | Load a dictionary stored hierarchically at db_key. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L152-L177 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.load_dict | def load_dict(self, db_key: str, hierarchical: bool = False) -> dict:
"""Load the dictionary at the specified key.
Hierarchically stored dictionaries use a ':' separator to expand
the dictionary into a set of Redis hashes.
Args:
db_key (str): Key at which the dictionary is ... | python | def load_dict(self, db_key: str, hierarchical: bool = False) -> dict:
"""Load the dictionary at the specified key.
Hierarchically stored dictionaries use a ':' separator to expand
the dictionary into a set of Redis hashes.
Args:
db_key (str): Key at which the dictionary is ... | Load the dictionary at the specified key.
Hierarchically stored dictionaries use a ':' separator to expand
the dictionary into a set of Redis hashes.
Args:
db_key (str): Key at which the dictionary is stored in the db.
hierarchical (bool): If True, expect the dictionary... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L180-L204 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.load_dict_values | def load_dict_values(self, db_key: str, dict_keys: List[str],
hierarchical: bool = False) -> List:
"""Load values from a dictionary with the specified dict_keys.
Args:
db_key (str): Key where the dictionary is stored
dict_keys (List[str]): Keys within th... | python | def load_dict_values(self, db_key: str, dict_keys: List[str],
hierarchical: bool = False) -> List:
"""Load values from a dictionary with the specified dict_keys.
Args:
db_key (str): Key where the dictionary is stored
dict_keys (List[str]): Keys within th... | Load values from a dictionary with the specified dict_keys.
Args:
db_key (str): Key where the dictionary is stored
dict_keys (List[str]): Keys within the dictionary to load.
hierarchical (bool): If True, expect the dictionary to have been
stored hierarchicall... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L206-L247 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.set_hash_value | def set_hash_value(self, key, field, value, pipeline=False):
"""Set the value of field in a hash stored at key.
Args:
key (str): key (name) of the hash
field (str): Field within the hash to set
value: Value to set
pipeline (bool): True, start a transactio... | python | def set_hash_value(self, key, field, value, pipeline=False):
"""Set the value of field in a hash stored at key.
Args:
key (str): key (name) of the hash
field (str): Field within the hash to set
value: Value to set
pipeline (bool): True, start a transactio... | Set the value of field in a hash stored at key.
Args:
key (str): key (name) of the hash
field (str): Field within the hash to set
value: Value to set
pipeline (bool): True, start a transaction block. Default false. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L264-L278 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.prepend_to_list | def prepend_to_list(self, key, *value, pipeline=False):
"""Add new element to the start of the list stored at key.
Args:
key (str): Key where the list is stored
value: Value to add to the list
pipeline (bool): True, start a transaction block. Default false.
... | python | def prepend_to_list(self, key, *value, pipeline=False):
"""Add new element to the start of the list stored at key.
Args:
key (str): Key where the list is stored
value: Value to add to the list
pipeline (bool): True, start a transaction block. Default false.
... | Add new element to the start of the list stored at key.
Args:
key (str): Key where the list is stored
value: Value to add to the list
pipeline (bool): True, start a transaction block. Default false. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L308-L320 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.append_to_list | def append_to_list(self, key, *value, pipeline=False):
"""Add new element to the end of the list stored at key.
Args:
key (str): Key where the list is stored
value: Value to add to the list
pipeline (bool): True, start a transaction block. Default false.
"""... | python | def append_to_list(self, key, *value, pipeline=False):
"""Add new element to the end of the list stored at key.
Args:
key (str): Key where the list is stored
value: Value to add to the list
pipeline (bool): True, start a transaction block. Default false.
"""... | Add new element to the end of the list stored at key.
Args:
key (str): Key where the list is stored
value: Value to add to the list
pipeline (bool): True, start a transaction block. Default false. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L323-L335 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.get_list | def get_list(self, key, pipeline=False):
"""Get all the value in the list stored at key.
Args:
key (str): Key where the list is stored.
pipeline (bool): True, start a transaction block. Default false.
Returns:
list: values in the list ordered by list index
... | python | def get_list(self, key, pipeline=False):
"""Get all the value in the list stored at key.
Args:
key (str): Key where the list is stored.
pipeline (bool): True, start a transaction block. Default false.
Returns:
list: values in the list ordered by list index
... | Get all the value in the list stored at key.
Args:
key (str): Key where the list is stored.
pipeline (bool): True, start a transaction block. Default false.
Returns:
list: values in the list ordered by list index | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L352-L366 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.delete | def delete(self, *names: str, pipeline=False):
"""Delete one or more keys specified by names.
Args:
names (str): Names of keys to delete
pipeline (bool): True, start a transaction block. Default false.
"""
if pipeline:
self._pipeline.delete(*names)
... | python | def delete(self, *names: str, pipeline=False):
"""Delete one or more keys specified by names.
Args:
names (str): Names of keys to delete
pipeline (bool): True, start a transaction block. Default false.
"""
if pipeline:
self._pipeline.delete(*names)
... | Delete one or more keys specified by names.
Args:
names (str): Names of keys to delete
pipeline (bool): True, start a transaction block. Default false. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L397-L407 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.get_event | def get_event(self, event_name, event_history=None):
"""Get an event from the database.
Gets an event from the named event list removing the event and
adding it to the event history.
Args:
event_name (str): Event list key.
event_history (str, optional): Event hi... | python | def get_event(self, event_name, event_history=None):
"""Get an event from the database.
Gets an event from the named event list removing the event and
adding it to the event history.
Args:
event_name (str): Event list key.
event_history (str, optional): Event hi... | Get an event from the database.
Gets an event from the named event list removing the event and
adding it to the event history.
Args:
event_name (str): Event list key.
event_history (str, optional): Event history list.
Returns:
str: string representa... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L437-L453 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.remove_from_list | def remove_from_list(self, key: str, value, count: int = 0,
pipeline: bool = False):
"""Remove specified value(s) from the list stored at key.
Args:
key (str): Key where the list is stored.
value: value to remove
count (int): Number of entrie... | python | def remove_from_list(self, key: str, value, count: int = 0,
pipeline: bool = False):
"""Remove specified value(s) from the list stored at key.
Args:
key (str): Key where the list is stored.
value: value to remove
count (int): Number of entrie... | Remove specified value(s) from the list stored at key.
Args:
key (str): Key where the list is stored.
value: value to remove
count (int): Number of entries to remove, default 0 == all
pipeline(bool): If True, start a transaction block. Default False. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L470-L491 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.watch | def watch(self, key, pipeline=False):
"""Watch the given key.
Marks the given key to be watch for conditional execution
of a transaction.
Args:
key (str): Key that needs to be watched
pipeline (bool): True, start a transaction block. Default false.
"""
... | python | def watch(self, key, pipeline=False):
"""Watch the given key.
Marks the given key to be watch for conditional execution
of a transaction.
Args:
key (str): Key that needs to be watched
pipeline (bool): True, start a transaction block. Default false.
"""
... | Watch the given key.
Marks the given key to be watch for conditional execution
of a transaction.
Args:
key (str): Key that needs to be watched
pipeline (bool): True, start a transaction block. Default false. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L504-L518 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py | ConfigDb.publish | def publish(self, channel, message, pipeline=False):
"""Post a message to a given channel.
Args:
channel (str): Channel where the message will be published
message (str): Message to publish
pipeline (bool): True, start a transaction block. Default false.
"""... | python | def publish(self, channel, message, pipeline=False):
"""Post a message to a given channel.
Args:
channel (str): Channel where the message will be published
message (str): Message to publish
pipeline (bool): True, start a transaction block. Default false.
"""... | Post a message to a given channel.
Args:
channel (str): Channel where the message will be published
message (str): Message to publish
pipeline (bool): True, start a transaction block. Default false. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L521-L533 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/master_controller_healthcheck.py | MasterHealthCheck.get_services_health | def get_services_health(self) -> dict:
"""Get the health of all services.
Returns:
dict, services id and health status
"""
# Initialise
services_health = {}
# Get Service IDs
services_ids = self._get_services()
for service_id in services_id... | python | def get_services_health(self) -> dict:
"""Get the health of all services.
Returns:
dict, services id and health status
"""
# Initialise
services_health = {}
# Get Service IDs
services_ids = self._get_services()
for service_id in services_id... | Get the health of all services.
Returns:
dict, services id and health status | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/master_controller_healthcheck.py#L41-L64 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/master_controller_healthcheck.py | MasterHealthCheck.get_overall_services_health | def get_overall_services_health(self) -> str:
"""Get the overall health of all the services.
Returns:
str, overall health status
"""
services_health_status = self.get_services_health()
# Evaluate overall health
health_status = all(status == "Healthy" for st... | python | def get_overall_services_health(self) -> str:
"""Get the overall health of all the services.
Returns:
str, overall health status
"""
services_health_status = self.get_services_health()
# Evaluate overall health
health_status = all(status == "Healthy" for st... | Get the overall health of all the services.
Returns:
str, overall health status | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/master_controller_healthcheck.py#L66-L85 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/master_controller/master_controller_healthcheck.py | MasterHealthCheck.get_service_health | def get_service_health(service_id: str) -> str:
"""Get the health of a service using service_id.
Args:
service_id
Returns:
str, health status
"""
# Check if the current and actual replica levels are the same
if DC.get_replicas(service_id) != DC.... | python | def get_service_health(service_id: str) -> str:
"""Get the health of a service using service_id.
Args:
service_id
Returns:
str, health status
"""
# Check if the current and actual replica levels are the same
if DC.get_replicas(service_id) != DC.... | Get the health of a service using service_id.
Args:
service_id
Returns:
str, health status | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/master_controller/master_controller_healthcheck.py#L92-L108 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/health.py | get | def get():
"""Check the health of this service"""
uptime = time.time() - START_TIME
response = dict(uptime=f'{uptime:.2f}s',
links=dict(root='{}'.format(get_root_url())))
# TODO(BM) check if we can connect to the config database ...
# try:
# DB.get_sub_array_ids()
# ... | python | def get():
"""Check the health of this service"""
uptime = time.time() - START_TIME
response = dict(uptime=f'{uptime:.2f}s',
links=dict(root='{}'.format(get_root_url())))
# TODO(BM) check if we can connect to the config database ...
# try:
# DB.get_sub_array_ids()
# ... | Check the health of this service | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/health.py#L17-L29 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py | main | def main():
"""Main function for SPEAD receiver module."""
# Check command line arguments.
if len(sys.argv) < 2:
raise RuntimeError('Usage: python3 async_recv.py <json config>')
# Set up logging.
sip_logging.init_logger(show_thread=True)
# Load SPEAD configuration from JSON file.
#... | python | def main():
"""Main function for SPEAD receiver module."""
# Check command line arguments.
if len(sys.argv) < 2:
raise RuntimeError('Usage: python3 async_recv.py <json config>')
# Set up logging.
sip_logging.init_logger(show_thread=True)
# Load SPEAD configuration from JSON file.
#... | Main function for SPEAD receiver module. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py#L171-L187 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py | SpeadReceiver.process_buffer | def process_buffer(self, i_block, receive_buffer):
"""Blocking function to process the received heaps.
This is run in an executor.
"""
self._log.info("Worker thread processing block %i", i_block)
time_overall0 = time.time()
time_unpack = 0.0
time_write = 0.0
... | python | def process_buffer(self, i_block, receive_buffer):
"""Blocking function to process the received heaps.
This is run in an executor.
"""
self._log.info("Worker thread processing block %i", i_block)
time_overall0 = time.time()
time_unpack = 0.0
time_write = 0.0
... | Blocking function to process the received heaps.
This is run in an executor. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py#L50-L114 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py | SpeadReceiver._run_loop | async def _run_loop(self, executor):
"""Main loop."""
loop = asyncio.get_event_loop()
# Get first heap in each stream (should be empty).
self._log.info("Waiting for %d streams to start...", self._num_streams)
for stream in self._streams:
await stream.get(loop=loop)
... | python | async def _run_loop(self, executor):
"""Main loop."""
loop = asyncio.get_event_loop()
# Get first heap in each stream (should be empty).
self._log.info("Waiting for %d streams to start...", self._num_streams)
for stream in self._streams:
await stream.get(loop=loop)
... | Main loop. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py#L116-L159 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py | SpeadReceiver.run | def run(self):
"""Starts the receiver."""
executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
loop = asyncio.get_event_loop()
loop.run_until_complete(self._run_loop(executor))
self._log.info('Shutting down...')
executor.shutdown() | python | def run(self):
"""Starts the receiver."""
executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
loop = asyncio.get_event_loop()
loop.run_until_complete(self._run_loop(executor))
self._log.info('Shutting down...')
executor.shutdown() | Starts the receiver. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ingest_visibilities/recv/async_recv.py#L161-L167 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/receive_pss/pulsar_search.py | PulsarReceiver.close | def close(self):
"""Add docstring!"""
# Seek to the start of the buffer
self.seek(0)
while True:
# Copy bytes from the buffer until we reach the end of the JSON
brace_count = 0
quoted = False
json_string = ''
while True:
... | python | def close(self):
"""Add docstring!"""
# Seek to the start of the buffer
self.seek(0)
while True:
# Copy bytes from the buffer until we reach the end of the JSON
brace_count = 0
quoted = False
json_string = ''
while True:
... | Add docstring! | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/receive_pss/pulsar_search.py#L27-L96 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/receive_pss/pulsar_search.py | PulsarStart.run | def run(self):
"""Start the FTP Server for pulsar search."""
self._log.info('Starting Pulsar Search Interface')
# Instantiate a dummy authorizer for managing 'virtual' users
authorizer = DummyAuthorizer()
# Define a new user having full r/w permissions and a read-only
# ... | python | def run(self):
"""Start the FTP Server for pulsar search."""
self._log.info('Starting Pulsar Search Interface')
# Instantiate a dummy authorizer for managing 'virtual' users
authorizer = DummyAuthorizer()
# Define a new user having full r/w permissions and a read-only
# ... | Start the FTP Server for pulsar search. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/receive_pss/pulsar_search.py#L131-L162 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_stage.py | WorkflowStage.status | def status(self) -> str:
"""Return the workflow stage status."""
# As status is a modifiable property, have to reload from the db.
self._config = self._load_config()
return self._config.get('status') | python | def status(self) -> str:
"""Return the workflow stage status."""
# As status is a modifiable property, have to reload from the db.
self._config = self._load_config()
return self._config.get('status') | Return the workflow stage status. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_stage.py#L62-L66 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_stage.py | WorkflowStage.status | def status(self, value):
"""Set the workflow stage status."""
# FIXME(BM) This is currently a hack because workflow stages
# don't each have their own db entry.
pb_key = SchedulingObject.get_key(PB_KEY, self._pb_id)
stages = DB.get_hash_value(pb_key, 'workflow_stages')
... | python | def status(self, value):
"""Set the workflow stage status."""
# FIXME(BM) This is currently a hack because workflow stages
# don't each have their own db entry.
pb_key = SchedulingObject.get_key(PB_KEY, self._pb_id)
stages = DB.get_hash_value(pb_key, 'workflow_stages')
... | Set the workflow stage status. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_stage.py#L69-L77 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_stage.py | WorkflowStage._load_config | def _load_config(self):
"""Load the workflow stage config from the database."""
pb_key = SchedulingObject.get_key(PB_KEY, self._pb_id)
stages = DB.get_hash_value(pb_key, 'workflow_stages')
stages = ast.literal_eval(stages)
return stages[self._index] | python | def _load_config(self):
"""Load the workflow stage config from the database."""
pb_key = SchedulingObject.get_key(PB_KEY, self._pb_id)
stages = DB.get_hash_value(pb_key, 'workflow_stages')
stages = ast.literal_eval(stages)
return stages[self._index] | Load the workflow stage config from the database. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/workflow_stage.py#L130-L135 |
SKA-ScienceDataProcessor/integration-prototype | sip/tango_control/tango_processing_block/app/register_devices.py | parse_command_args | def parse_command_args():
"""Command line parser."""
parser = argparse.ArgumentParser(description='Register PB devices.')
parser.add_argument('num_pb', type=int,
help='Number of PBs devices to register.')
return parser.parse_args() | python | def parse_command_args():
"""Command line parser."""
parser = argparse.ArgumentParser(description='Register PB devices.')
parser.add_argument('num_pb', type=int,
help='Number of PBs devices to register.')
return parser.parse_args() | Command line parser. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_processing_block/app/register_devices.py#L11-L16 |
SKA-ScienceDataProcessor/integration-prototype | sip/tango_control/tango_processing_block/app/register_devices.py | register_pb_devices | def register_pb_devices(num_pbs: int = 100):
"""Register PBs devices.
Note(BMo): Ideally we do not want to register any devices here. There
does not seem to be a way to create a device server with no registered
devices in Tango. This is (probably) because Tango devices must have been
registered bef... | python | def register_pb_devices(num_pbs: int = 100):
"""Register PBs devices.
Note(BMo): Ideally we do not want to register any devices here. There
does not seem to be a way to create a device server with no registered
devices in Tango. This is (probably) because Tango devices must have been
registered bef... | Register PBs devices.
Note(BMo): Ideally we do not want to register any devices here. There
does not seem to be a way to create a device server with no registered
devices in Tango. This is (probably) because Tango devices must have been
registered before the server starts ... | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_processing_block/app/register_devices.py#L19-L37 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py | SchedulingBlockInstance.from_config | def from_config(cls, config_dict: dict, schema_path: str = None):
"""Create an SBI object from the specified configuration dict.
NOTE(BM) This should really be done as a single atomic db transaction.
Args:
config_dict(dict): SBI configuration dictionary
schema_path(str,... | python | def from_config(cls, config_dict: dict, schema_path: str = None):
"""Create an SBI object from the specified configuration dict.
NOTE(BM) This should really be done as a single atomic db transaction.
Args:
config_dict(dict): SBI configuration dictionary
schema_path(str,... | Create an SBI object from the specified configuration dict.
NOTE(BM) This should really be done as a single atomic db transaction.
Args:
config_dict(dict): SBI configuration dictionary
schema_path(str, optional): Path to the SBI config schema. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L39-L97 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py | SchedulingBlockInstance.abort | def abort(self):
"""Abort the SBI (and associated PBs)."""
self.set_status('aborted')
DB.remove_from_list('{}:active'.format(self._type), self._id)
DB.append_to_list('{}:aborted'.format(self._type), self._id)
sbi_pb_ids = ast.literal_eval(
DB.get_hash_value(self._key,... | python | def abort(self):
"""Abort the SBI (and associated PBs)."""
self.set_status('aborted')
DB.remove_from_list('{}:active'.format(self._type), self._id)
DB.append_to_list('{}:aborted'.format(self._type), self._id)
sbi_pb_ids = ast.literal_eval(
DB.get_hash_value(self._key,... | Abort the SBI (and associated PBs). | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L114-L124 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py | SchedulingBlockInstance.get_pb_ids | def get_pb_ids(self) -> List[str]:
"""Return the list of PB ids associated with the SBI.
Returns:
list, Processing block ids
"""
values = DB.get_hash_value(self._key, 'processing_block_ids')
return ast.literal_eval(values) | python | def get_pb_ids(self) -> List[str]:
"""Return the list of PB ids associated with the SBI.
Returns:
list, Processing block ids
"""
values = DB.get_hash_value(self._key, 'processing_block_ids')
return ast.literal_eval(values) | Return the list of PB ids associated with the SBI.
Returns:
list, Processing block ids | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L133-L141 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py | SchedulingBlockInstance.get_id | def get_id(date=None, project: str = 'sip',
instance_id: int = None) -> str:
"""Get a SBI Identifier.
Args:
date (str or datetime.datetime, optional): UTC date of the SBI
project (str, optional ): Project Name
instance_id (int, optional): SBI instance ... | python | def get_id(date=None, project: str = 'sip',
instance_id: int = None) -> str:
"""Get a SBI Identifier.
Args:
date (str or datetime.datetime, optional): UTC date of the SBI
project (str, optional ): Project Name
instance_id (int, optional): SBI instance ... | Get a SBI Identifier.
Args:
date (str or datetime.datetime, optional): UTC date of the SBI
project (str, optional ): Project Name
instance_id (int, optional): SBI instance identifier
Returns:
str, Scheduling Block Instance (SBI) ID. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L144-L166 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py | SchedulingBlockInstance._add_pb | def _add_pb(pb_config: dict):
"""."""
# Add status field to the PB
pb_config['status'] = 'created'
# Add created and updated timestamps to the PB
timestamp = datetime.datetime.utcnow().isoformat()
pb_config['created'] = timestamp
pb_config['updated'] = timestamp
... | python | def _add_pb(pb_config: dict):
"""."""
# Add status field to the PB
pb_config['status'] = 'created'
# Add created and updated timestamps to the PB
timestamp = datetime.datetime.utcnow().isoformat()
pb_config['created'] = timestamp
pb_config['updated'] = timestamp
... | . | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L169-L208 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py | SchedulingBlockInstance._update_workflow_definition | def _update_workflow_definition(pb_config: dict):
"""Update the PB configuration workflow definition.
Args:
pb_config (dict): PB configuration dictionary
Raises:
RunTimeError, if the workflow definition (id, version)
specified in the sbi_config is not known.... | python | def _update_workflow_definition(pb_config: dict):
"""Update the PB configuration workflow definition.
Args:
pb_config (dict): PB configuration dictionary
Raises:
RunTimeError, if the workflow definition (id, version)
specified in the sbi_config is not known.... | Update the PB configuration workflow definition.
Args:
pb_config (dict): PB configuration dictionary
Raises:
RunTimeError, if the workflow definition (id, version)
specified in the sbi_config is not known. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L211-L236 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/home.py | root | def root():
"""Placeholder root url for the PCI.
Ideally this should never be called!
"""
response = {
"links": {
"message": "Welcome to the SIP Processing Controller Interface",
"items": [
{"href": "{}health".format(request.url)},
{"href"... | python | def root():
"""Placeholder root url for the PCI.
Ideally this should never be called!
"""
response = {
"links": {
"message": "Welcome to the SIP Processing Controller Interface",
"items": [
{"href": "{}health".format(request.url)},
{"href"... | Placeholder root url for the PCI.
Ideally this should never be called! | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/home.py#L11-L27 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/old.db/mock/init.py | generate_scheduling_block_id | def generate_scheduling_block_id(num_blocks, project='test'):
"""Generate a scheduling_block id"""
_date = strftime("%Y%m%d", gmtime())
_project = project
for i in range(num_blocks):
yield '{}-{}-sbi{:03d}'.format(_date, _project, i) | python | def generate_scheduling_block_id(num_blocks, project='test'):
"""Generate a scheduling_block id"""
_date = strftime("%Y%m%d", gmtime())
_project = project
for i in range(num_blocks):
yield '{}-{}-sbi{:03d}'.format(_date, _project, i) | Generate a scheduling_block id | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/mock/init.py#L18-L23 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/old.db/mock/init.py | main | def main():
"""Main Function"""
num_blocks = int(sys.argv[1]) if len(sys.argv) == 2 else 3
clear_db()
for block_id in generate_scheduling_block_id(num_blocks=num_blocks,
project='sip'):
config = {
"id": block_id,
"sub_array... | python | def main():
"""Main Function"""
num_blocks = int(sys.argv[1]) if len(sys.argv) == 2 else 3
clear_db()
for block_id in generate_scheduling_block_id(num_blocks=num_blocks,
project='sip'):
config = {
"id": block_id,
"sub_array... | Main Function | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/old.db/mock/init.py#L26-L50 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/utils.py | add_scheduling_block | def add_scheduling_block(config):
"""Adds a scheduling block to the database, returning a response object"""
try:
DB.add_sbi(config)
except jsonschema.ValidationError as error:
error_dict = error.__dict__
for key in error_dict:
error_dict[key] = error_dict[key].__str__()
... | python | def add_scheduling_block(config):
"""Adds a scheduling block to the database, returning a response object"""
try:
DB.add_sbi(config)
except jsonschema.ValidationError as error:
error_dict = error.__dict__
for key in error_dict:
error_dict[key] = error_dict[key].__str__()
... | Adds a scheduling block to the database, returning a response object | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/utils.py#L24-L45 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/utils.py | missing_db_response | def missing_db_response(func):
"""Decorator to check connection exceptions"""
@wraps(func)
def with_exception_handling(*args, **kwargs):
"""Wrapper to check for connection failures"""
try:
return func(*args, **kwargs)
except ConnectionError as error:
return (d... | python | def missing_db_response(func):
"""Decorator to check connection exceptions"""
@wraps(func)
def with_exception_handling(*args, **kwargs):
"""Wrapper to check for connection failures"""
try:
return func(*args, **kwargs)
except ConnectionError as error:
return (d... | Decorator to check connection exceptions | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/utils.py#L48-L60 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/mock_workflow/mock_workflow_stage/task.py | main | def main():
"""Run the workflow task."""
log = logging.getLogger('sip.mock_workflow_stage')
if len(sys.argv) != 2:
log.critical('Expecting JSON string as first argument!')
return
config = json.loads(sys.argv[1])
log.info('Running mock_workflow_stage (version: %s).', __version__)
... | python | def main():
"""Run the workflow task."""
log = logging.getLogger('sip.mock_workflow_stage')
if len(sys.argv) != 2:
log.critical('Expecting JSON string as first argument!')
return
config = json.loads(sys.argv[1])
log.info('Running mock_workflow_stage (version: %s).', __version__)
... | Run the workflow task. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/mock_workflow/mock_workflow_stage/task.py#L12-L36 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/log_spammer/log_spammer.py | main | def main(sleep_length=0.1):
"""Log to stdout using python logging in a while loop"""
log = logging.getLogger('sip.examples.log_spammer')
log.info('Starting to spam log messages every %fs', sleep_length)
counter = 0
try:
while True:
log.info('Hello %06i (log_spammer: %s, sip logg... | python | def main(sleep_length=0.1):
"""Log to stdout using python logging in a while loop"""
log = logging.getLogger('sip.examples.log_spammer')
log.info('Starting to spam log messages every %fs', sleep_length)
counter = 0
try:
while True:
log.info('Hello %06i (log_spammer: %s, sip logg... | Log to stdout using python logging in a while loop | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/log_spammer/log_spammer.py#L11-L24 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ical_dask/pipelines/imaging_processing.py | init_logging | def init_logging():
"""Initialise Python logging."""
fmt = '%(asctime)s.%(msecs)03d | %(name)-60s | %(levelname)-7s ' \
'| %(message)s'
logging.basicConfig(format=fmt, datefmt='%H:%M:%S', level=logging.DEBUG) | python | def init_logging():
"""Initialise Python logging."""
fmt = '%(asctime)s.%(msecs)03d | %(name)-60s | %(levelname)-7s ' \
'| %(message)s'
logging.basicConfig(format=fmt, datefmt='%H:%M:%S', level=logging.DEBUG) | Initialise Python logging. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ical_dask/pipelines/imaging_processing.py#L38-L42 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/ical_dask/pipelines/imaging_processing.py | main | def main():
"""Run the workflow."""
init_logging()
LOG.info("Starting imaging-pipeline")
# Read parameters
PARFILE = 'parameters.json'
if len(sys.argv) > 1:
PARFILE = sys.argv[1]
LOG.info("JSON parameter file = %s", PARFILE)
try:
with open(PARFILE, "r") as par_file:
... | python | def main():
"""Run the workflow."""
init_logging()
LOG.info("Starting imaging-pipeline")
# Read parameters
PARFILE = 'parameters.json'
if len(sys.argv) > 1:
PARFILE = sys.argv[1]
LOG.info("JSON parameter file = %s", PARFILE)
try:
with open(PARFILE, "r") as par_file:
... | Run the workflow. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/ical_dask/pipelines/imaging_processing.py#L45-L233 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/subarray.py | get | def get(sub_array_id):
"""Sub array detail resource.
This method will list scheduling blocks and processing blocks
in the specified sub-array.
"""
if not re.match(r'^subarray-0[0-9]|subarray-1[0-5]$', sub_array_id):
response = dict(error='Invalid sub-array ID specified "{}" does not '
... | python | def get(sub_array_id):
"""Sub array detail resource.
This method will list scheduling blocks and processing blocks
in the specified sub-array.
"""
if not re.match(r'^subarray-0[0-9]|subarray-1[0-5]$', sub_array_id):
response = dict(error='Invalid sub-array ID specified "{}" does not '
... | Sub array detail resource.
This method will list scheduling blocks and processing blocks
in the specified sub-array. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/subarray.py#L20-L52 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/subarray.py | create | def create(sub_array_id):
"""Create / register a Scheduling Block instance with SDP."""
config = request.data
config['sub_array_id'] = 'subarray-{:02d}'.format(sub_array_id)
return add_scheduling_block(config) | python | def create(sub_array_id):
"""Create / register a Scheduling Block instance with SDP."""
config = request.data
config['sub_array_id'] = 'subarray-{:02d}'.format(sub_array_id)
return add_scheduling_block(config) | Create / register a Scheduling Block instance with SDP. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/subarray.py#L57-L61 |
SKA-ScienceDataProcessor/integration-prototype | sip/examples/flask_processing_controller/app/api/subarray.py | get_scheduling_block | def get_scheduling_block(sub_array_id, block_id):
"""Return the list of scheduling blocks instances associated with the sub
array"""
block_ids = DB.get_sub_array_sbi_ids(sub_array_id)
if block_id in block_ids:
block = DB.get_block_details([block_id]).__next__()
return block, HTTPStatus.O... | python | def get_scheduling_block(sub_array_id, block_id):
"""Return the list of scheduling blocks instances associated with the sub
array"""
block_ids = DB.get_sub_array_sbi_ids(sub_array_id)
if block_id in block_ids:
block = DB.get_block_details([block_id]).__next__()
return block, HTTPStatus.O... | Return the list of scheduling blocks instances associated with the sub
array | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/subarray.py#L76-L84 |
SKA-ScienceDataProcessor/integration-prototype | sip/execution_control/configuration_db/setup.py | package_files | def package_files(directory):
"""Get list of data files to add to the package."""
paths = []
for (path, _, file_names) in walk(directory):
for filename in file_names:
paths.append(join('..', path, filename))
return paths | python | def package_files(directory):
"""Get list of data files to add to the package."""
paths = []
for (path, _, file_names) in walk(directory):
for filename in file_names:
paths.append(join('..', path, filename))
return paths | Get list of data files to add to the package. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/setup.py#L9-L15 |
SKA-ScienceDataProcessor/integration-prototype | sip/tango_control/tango_master/app/sdp_master_ds.py | register_master | def register_master():
"""Register the SDP Master device."""
tango_db = Database()
device = "sip_sdp/elt/master"
device_info = DbDevInfo()
device_info._class = "SDPMasterDevice"
device_info.server = "sdp_master_ds/1"
device_info.name = device
devices = tango_db.get_device_name(device_inf... | python | def register_master():
"""Register the SDP Master device."""
tango_db = Database()
device = "sip_sdp/elt/master"
device_info = DbDevInfo()
device_info._class = "SDPMasterDevice"
device_info.server = "sdp_master_ds/1"
device_info.name = device
devices = tango_db.get_device_name(device_inf... | Register the SDP Master device. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_ds.py#L21-L33 |
SKA-ScienceDataProcessor/integration-prototype | sip/tango_control/tango_master/app/sdp_master_ds.py | main | def main(args=None, **kwargs):
"""Run the Tango SDP Master device server."""
LOG.info('Starting %s', __service_id__)
return run([SDPMasterDevice], verbose=True, msg_stream=sys.stdout,
args=args, **kwargs) | python | def main(args=None, **kwargs):
"""Run the Tango SDP Master device server."""
LOG.info('Starting %s', __service_id__)
return run([SDPMasterDevice], verbose=True, msg_stream=sys.stdout,
args=args, **kwargs) | Run the Tango SDP Master device server. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/tango_master/app/sdp_master_ds.py#L36-L40 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/receive_pss/csp_pss_sender/app/__main__.py | parse_command_line | def parse_command_line():
"""Parse command line arguments."""
parser = argparse.ArgumentParser(
prog='csp_pulsar_sender',
description='Send fake pulsar data using ftp protocol.')
parser.add_argument('config_file', type=argparse.FileType('r'),
help='JSON configuration ... | python | def parse_command_line():
"""Parse command line arguments."""
parser = argparse.ArgumentParser(
prog='csp_pulsar_sender',
description='Send fake pulsar data using ftp protocol.')
parser.add_argument('config_file', type=argparse.FileType('r'),
help='JSON configuration ... | Parse command line arguments. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/receive_pss/csp_pss_sender/app/__main__.py#L14-L25 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/receive_pss/csp_pss_sender/app/__main__.py | _init_log | def _init_log(level=logging.DEBUG):
"""Initialise the logging object.
Args:
level (int): Logging level.
Returns:
Logger: Python logging object.
"""
log = logging.getLogger(__file__)
log.setLevel(level)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(level)
... | python | def _init_log(level=logging.DEBUG):
"""Initialise the logging object.
Args:
level (int): Logging level.
Returns:
Logger: Python logging object.
"""
log = logging.getLogger(__file__)
log.setLevel(level)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(level)
... | Initialise the logging object.
Args:
level (int): Logging level.
Returns:
Logger: Python logging object. | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/receive_pss/csp_pss_sender/app/__main__.py#L28-L43 |
SKA-ScienceDataProcessor/integration-prototype | sip/science_pipeline_workflows/receive_pss/csp_pss_sender/app/__main__.py | main | def main():
"""Main script function"""
# Create simulation object, and start streaming SPEAD heaps
sender = PulsarSender()
# Parse command line arguments
args = parse_command_line()
# Initialise logging.
_log = _init_log(level=logging.DEBUG if args.verbose else logging.INFO)
# Load co... | python | def main():
"""Main script function"""
# Create simulation object, and start streaming SPEAD heaps
sender = PulsarSender()
# Parse command line arguments
args = parse_command_line()
# Initialise logging.
_log = _init_log(level=logging.DEBUG if args.verbose else logging.INFO)
# Load co... | Main script function | https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/science_pipeline_workflows/receive_pss/csp_pss_sender/app/__main__.py#L46-L63 |
DiamondLightSource/python-workflows | workflows/recipe/__init__.py | _wrap_subscription | def _wrap_subscription(
transport_layer, subscription_call, channel, callback, *args, **kwargs
):
"""Internal method to create an intercepting function for incoming messages
to interpret recipes. This function is then used to subscribe to a channel
on the transport layer.
:param transport_layer: R... | python | def _wrap_subscription(
transport_layer, subscription_call, channel, callback, *args, **kwargs
):
"""Internal method to create an intercepting function for incoming messages
to interpret recipes. This function is then used to subscribe to a channel
on the transport layer.
:param transport_layer: R... | Internal method to create an intercepting function for incoming messages
to interpret recipes. This function is then used to subscribe to a channel
on the transport layer.
:param transport_layer: Reference to underlying transport object.
:param subscription_call: Reference to the subscribing functio... | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/recipe/__init__.py#L7-L59 |
DiamondLightSource/python-workflows | workflows/recipe/__init__.py | wrap_subscribe | def wrap_subscribe(transport_layer, channel, callback, *args, **kwargs):
"""Listen to a queue on the transport layer, similar to the subscribe call in
transport/common_transport.py. Intercept all incoming messages and parse
for recipe information.
See common_transport.subscribe for possible additional k... | python | def wrap_subscribe(transport_layer, channel, callback, *args, **kwargs):
"""Listen to a queue on the transport layer, similar to the subscribe call in
transport/common_transport.py. Intercept all incoming messages and parse
for recipe information.
See common_transport.subscribe for possible additional k... | Listen to a queue on the transport layer, similar to the subscribe call in
transport/common_transport.py. Intercept all incoming messages and parse
for recipe information.
See common_transport.subscribe for possible additional keyword arguments.
:param transport_layer: Reference to underlying transpor... | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/recipe/__init__.py#L62-L78 |
DiamondLightSource/python-workflows | workflows/recipe/__init__.py | wrap_subscribe_broadcast | def wrap_subscribe_broadcast(transport_layer, channel, callback, *args, **kwargs):
"""Listen to a topic on the transport layer, similar to the
subscribe_broadcast call in transport/common_transport.py. Intercept all
incoming messages and parse for recipe information.
See common_transport.subscribe_broad... | python | def wrap_subscribe_broadcast(transport_layer, channel, callback, *args, **kwargs):
"""Listen to a topic on the transport layer, similar to the
subscribe_broadcast call in transport/common_transport.py. Intercept all
incoming messages and parse for recipe information.
See common_transport.subscribe_broad... | Listen to a topic on the transport layer, similar to the
subscribe_broadcast call in transport/common_transport.py. Intercept all
incoming messages and parse for recipe information.
See common_transport.subscribe_broadcast for possible arguments.
:param transport_layer: Reference to underlying transpo... | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/recipe/__init__.py#L81-L102 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService.start_transport | def start_transport(self):
"""If a transport object has been defined then connect it now."""
if self.transport:
if self.transport.connect():
self.log.debug("Service successfully connected to transport layer")
else:
raise RuntimeError("Service could... | python | def start_transport(self):
"""If a transport object has been defined then connect it now."""
if self.transport:
if self.transport.connect():
self.log.debug("Service successfully connected to transport layer")
else:
raise RuntimeError("Service could... | If a transport object has been defined then connect it now. | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L170-L183 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService._transport_interceptor | def _transport_interceptor(self, callback):
"""Takes a callback function and returns a function that takes headers and
messages and places them on the main service queue."""
def add_item_to_queue(header, message):
queue_item = (
Priority.TRANSPORT,
ne... | python | def _transport_interceptor(self, callback):
"""Takes a callback function and returns a function that takes headers and
messages and places them on the main service queue."""
def add_item_to_queue(header, message):
queue_item = (
Priority.TRANSPORT,
ne... | Takes a callback function and returns a function that takes headers and
messages and places them on the main service queue. | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L185-L201 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService.connect | def connect(self, frontend=None, commands=None):
"""Inject pipes connecting the service to the frontend. Two arguments are
supported: frontend= for messages from the service to the frontend,
and commands= for messages from the frontend to the service.
The injection should happen before t... | python | def connect(self, frontend=None, commands=None):
"""Inject pipes connecting the service to the frontend. Two arguments are
supported: frontend= for messages from the service to the frontend,
and commands= for messages from the frontend to the service.
The injection should happen before t... | Inject pipes connecting the service to the frontend. Two arguments are
supported: frontend= for messages from the service to the frontend,
and commands= for messages from the frontend to the service.
The injection should happen before the service is started, otherwise the
underlying file... | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L203-L213 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService.extend_log | def extend_log(self, field, value):
"""A context wherein a specified extra field in log messages is populated
with a fixed value. This affects all log messages within the context."""
self.__log_extensions.append((field, value))
try:
yield
except Exception as e:
... | python | def extend_log(self, field, value):
"""A context wherein a specified extra field in log messages is populated
with a fixed value. This affects all log messages within the context."""
self.__log_extensions.append((field, value))
try:
yield
except Exception as e:
... | A context wherein a specified extra field in log messages is populated
with a fixed value. This affects all log messages within the context. | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L216-L226 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService.__command_queue_listener | def __command_queue_listener(self):
"""Function to continuously retrieve data from the frontend. Commands are
sent to the central priority queue. If the pipe from the frontend is
closed the service shutdown is initiated. Check every second if service
has shut down, then terminate.
... | python | def __command_queue_listener(self):
"""Function to continuously retrieve data from the frontend. Commands are
sent to the central priority queue. If the pipe from the frontend is
closed the service shutdown is initiated. Check every second if service
has shut down, then terminate.
... | Function to continuously retrieve data from the frontend. Commands are
sent to the central priority queue. If the pipe from the frontend is
closed the service shutdown is initiated. Check every second if service
has shut down, then terminate.
This function is run by a separate daemon thr... | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L228-L261 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService.__start_command_queue_listener | def __start_command_queue_listener(self):
"""Start the function __command_queue_listener in a separate thread. This
function continuously listens to the pipe connected to the frontend.
"""
thread_function = self.__command_queue_listener
class QueueListenerThread(threading.Thread... | python | def __start_command_queue_listener(self):
"""Start the function __command_queue_listener in a separate thread. This
function continuously listens to the pipe connected to the frontend.
"""
thread_function = self.__command_queue_listener
class QueueListenerThread(threading.Thread... | Start the function __command_queue_listener in a separate thread. This
function continuously listens to the pipe connected to the frontend. | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L263-L278 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService._log_send | def _log_send(self, logrecord):
"""Forward log records to the frontend."""
for field, value in self.__log_extensions:
setattr(logrecord, field, value)
self.__send_to_frontend({"band": "log", "payload": logrecord}) | python | def _log_send(self, logrecord):
"""Forward log records to the frontend."""
for field, value in self.__log_extensions:
setattr(logrecord, field, value)
self.__send_to_frontend({"band": "log", "payload": logrecord}) | Forward log records to the frontend. | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L280-L284 |
DiamondLightSource/python-workflows | workflows/services/common_service.py | CommonService._register_idle | def _register_idle(self, idle_time, callback):
"""Register a callback function that is run when idling for a given
time span (in seconds)."""
self._idle_callback = callback
self._idle_time = idle_time | python | def _register_idle(self, idle_time, callback):
"""Register a callback function that is run when idling for a given
time span (in seconds)."""
self._idle_callback = callback
self._idle_time = idle_time | Register a callback function that is run when idling for a given
time span (in seconds). | https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/services/common_service.py#L290-L294 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.