Closed tcezard closed 7 years ago
I've made some modification in the way the output placement and the next actions are handled.
# Retrieve samples/artifact/workflow stage
samples = l.get_samples(projectname='T00001')
art = samples[0].artifact
# Find workflow 'Email Test' and take its first stage
stage = l.get_workflows(name='Email Test')[0].stages[0]
# Queue the artifacts to the stage
l.route_artifacts([art], stage_uri=stage.uri)
# Create a new step from that queued artifact (container_type_name is optional if only one container type is permitted)
s = Step.create(l, protocol_step=stage.step, inputs=[art], container_type_name='Tube')
# Create the output container
ct = l.get_container_types(name='Tube')[0]
c = Container.create(l, type=ct)
# Retrieve the output artifact that was generated automatically from the input/output map
output_art = s.details.input_output_maps[0][1]['uri']
# Place the output artifact in the container
# Note that the placements is a list of tuple ( A, ( B, C ) )
# Where A is output artifact, B the output Container and C the location on this container
output_placement_list=[(output_art, (c, '1:1'))]
# set_placements creates the placement entity and "put" it
s.set_placements([c], output_placement_list)
# Move from "Record detail" window to the "Next Step"
s.advance()
# Set the next step
actions = s.actions.next_actions[0]['action'] = 'complete'
s.actions.put()
# Complete the step
s.advance()
Hope this makes sense
This PR adds the ability to create, fill in and complete a step through the API. The usage is still a bit clunky and could be made cleaner but it all works. There are also a few bug fixes Here is how you create a Step