Task

The momotor.rpc.task module contains helper functions to get the task id from TaskId messages

momotor.rpc.task.get_dotted_task_number(task_num)

Convert a task-number list into a dotted task-number. If task_num is empty or None, returns None

>>> get_dotted_task_number(None)
>>> get_dotted_task_number([])
>>> get_dotted_task_number([0])
'0'
>>> get_dotted_task_number([0, 0])
'0.0'
Parameters

task_num (Optional[Sequence[int]]) – The task number as a sequence

Return type

Optional[str]

Returns

Dotted version of task number

momotor.rpc.task.get_step_task_id(task_id)

Get the step task id from the TaskId message

A step-task-id is the step-id followed with dot-separated sub task number(s)

>>> get_step_task_id(TaskId(stepId='step'))
'step'
>>> get_step_task_id(TaskId(stepId='step', taskNumber=[0]))
'step.0'
>>> get_step_task_id(TaskId(stepId='step', taskNumber=[0, 0]))
'step.0.0'
Parameters

task_id (TaskId) – The TaskId message

Return type

str

Returns

the step-task-id