Story #15350
closed[Documentation] Add Python SDK recipe on how to get a container request's real state
100%
Description
CR's state depends both on its actual state and the container's.
Add a recipe to our Python SDK Cookbook to get the same state as the workbench show to the user.
Updated by Lucas Di Pentima over 5 years ago
Documentation update at ee6ee144d - branch 15350-pysdk-cookbook-recipe
Adds a Python SDK recipe to get a container request's state as done on workbench.
Updated by Eric Biagiotti over 5 years ago
Lucas Di Pentima wrote:
Documentation update at ee6ee144d - branch
15350-pysdk-cookbook-recipe
Adds a Python SDK recipe to get a container request's state as done on workbench.
- Might be a little easier to read if you store c['state'] in a variable. Up to you.
- Is it worth differentiating between Locked and Queued (i.e. return
c['state']
on line 14 or remove the else and let it fall through)? - Could simplify the
elif c['state'] = = 'Complete'
clause to check for non-zero and let thereturn c['state']
fall through to the end. - Can remove the last else in the
elif c['state'] == 'Running'
clause.
Updated by Lucas Di Pentima over 5 years ago
Eric Biagiotti wrote:
- Might be a little easier to read if you store c['state'] in a variable. Up to you.
I'm not sure, because I would also need to store cr['state']
on another, getting something like cr_state
and c_state
, both very similar.
- Is it worth differentiating between Locked and Queued (i.e. return
c['state']
on line 14 or remove the else and let it fall through)?
I based the recipe in what workbench does (https://github.com/curoverse/arvados/blob/master/apps/workbench/app/models/container_work_unit.rb#L101-L133), so I think it would be preferable to keep the same behavior.
- Could simplify the
elif c['state'] = = 'Complete'
clause to check for non-zero and let thereturn c['state']
fall through to the end.- Can remove the last else in the
elif c['state'] == 'Running'
clause.
Done both, thanks!
Updates at 4a55551f6
Updated by Lucas Di Pentima over 5 years ago
- Status changed from In Progress to Resolved
Applied in changeset arvados|fef85f35467eaf987c5277237539e68341cd548a.
Updated by Tom Morris about 5 years ago
- Related to Bug #15672: List of subprocesses limited in process view added