3. API¶
3.1. REANA AMQP Publisher¶
REANA-Commons module to manage AMQP connections on REANA.
-
class
reana_commons.publisher.
BasePublisher
(queue, routing_key, connection=None, exchange=None, durable=False)¶ Base publisher to MQ.
-
close
()¶ Close connection.
-
-
class
reana_commons.publisher.
WorkflowStatusPublisher
(**kwargs)¶ Progress publisher to MQ.
-
publish_workflow_status
(workflow_uuid, status, logs='', message=None)¶ Publish workflow status using the configured.
Parameters: - workflow_uudid – String which represents the workflow UUID.
- status – Integer which represents the status of the workflow, this is defined in the reana-db Workflow models.
- logs – String which represents the logs which the workflow has produced as output.
- message – Dictionary which includes additional information can be attached such as the overall progress of the workflow.
-
3.2. REANA AMQP Consumer¶
REANA-Commons module to manage AMQP consuming on REANA.
-
class
reana_commons.consumer.
BaseConsumer
(queue=None, connection=None, message_default_format=None)¶ Base RabbitMQ consumer.
-
get_consumers
(Consumer, channel)¶ Map consumers to specific queues.
Parameters: - Consumer – A
kombu.Consumer
to use for instantiating consumers. - channel – A
kombu.transport.virtual.AbstractChannel
.
- Consumer – A
-
on_message
(body, message)¶ Implement this method to manipulate the data received.
Parameters: - body – The received message already decoded in the specified format.
- message – A
kombu.transport.virtual.Message
.
-
3.3. REANA utilities¶
REANA-Commons utils.
-
reana_commons.utils.
build_caching_info_message
(job_spec, job_id, workflow_workspace, workflow_json, result_path)¶ Build the caching info message with correct formatting.
-
reana_commons.utils.
build_progress_message
(total=None, running=None, finished=None, failed=None, cached=None)¶ Build the progress message with correct formatting.
-
reana_commons.utils.
calculate_file_access_time
(workflow_workspace)¶ Calculate access times of files in workspace.
-
reana_commons.utils.
calculate_hash_of_dir
(directory, file_list=None)¶ Calculate hash of directory.
-
reana_commons.utils.
calculate_job_input_hash
(job_spec, workflow_json)¶ Calculate md5 hash of job specification and workflow json.
-
reana_commons.utils.
click_table_printer
(headers, _filter, data)¶ Generate space separated output for click commands.
-
reana_commons.utils.
copy_openapi_specs
(output_path, component)¶ Copy generated and validated openapi specs to reana-commons module.
-
reana_commons.utils.
create_cvmfs_persistent_volume_claim
(cvmfs_volume)¶ Create CVMFS persistent volume claim.
-
reana_commons.utils.
create_cvmfs_storage_class
(cvmfs_volume)¶ Create CVMFS storage class.
-
reana_commons.utils.
get_workflow_status_change_verb
(status)¶ Give the correct verb conjugation depending on status tense.
Parameters: status – String which represents the status the workflow changed to.
-
reana_commons.utils.
get_workspace_disk_usage
(workspace, summarize=False)¶ Retrieve disk usage information of a workspace.
-
reana_commons.utils.
render_cvmfs_pvc
(cvmfs_volume)¶ Render REANA_CVMFS_PVC_TEMPLATE.
-
reana_commons.utils.
render_cvmfs_sc
(cvmfs_volume)¶ Render REANA_CVMFS_SC_TEMPLATE.