Open csawye01 opened 4 years ago
Hi there, sorry for the slow reply! Unfortunately, several of us who developed/used this library no longer work at Edinburgh Genomics, so there's probably some discussion needed about what to do with it, e.g. continuing to support it or merging it back to the original SciLifeLab project.
Regarding your question, it looks like the action 'complete' is only available when you're at the last step of the workflow. To use 'nextstep', you need to set another attribute called 'step-uri' so that s.actions.next_actions[0]
looks something like:
{
'artifact': Artifact('an_artifact_uri'),
'action': 'nextstep',
'step-uri': 'a_step_uri'
}
However if you try to set this directly, you get a KeyError('step-uri is not a supported key for next action')
. The way to do it is to set the attribute step
to be a ProtocolStep object corresponding to the next step, and this gets translated behind the scenes - the trickery gets done here. So you'd need to do something like:
s.actions.next_actions[0]['action'] = 'nextstep'
s.actions.next_actions[0]['step'] = some_protocolstep_object
For reference, we have some scripts built on top of this library for performing various tasks - see https://github.com/EdinburghGenomics/clarity_scripts/blob/master/EPPs/common.py#L158, which completes workflows and assigns next steps. It deals with protocol objects though, so I'm not 100% sure how the workflows and step creation would tie into it - tagging @tcezard, who may know more about this than me.
I am having an issue when using the API to complete one step and move to the next. I followed the example in
https://pyclarity-lims.readthedocs.io/en/latest/PracticalExamples.html#start-and-complete-a-new-step-from-submitted-samples
until the end where I have an error.When trying to execute the line
actions = s.actions.next_actions[0]['action'] = 'complete'
I get the error ofThe valid actions are: [nextstep, repeat, remove, review, rework, completerepeat]
When I try to use the action
nextstep
it requires a uri but there isn't documentation of how to assign this. I have tried the line below but that does not work.actions = s.actions.next_actions[0]['action']['nextsteps'] = 'step_uri_example
Is it possible to create more documentation on how to use this or advise on how to proceed?