Story #15350

[Documentation] Add Python SDK recipe on how to get a container request's real state

Added by Lucas Di Pentima 14 days ago. Updated 13 days ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Documentation
Target version:
Start date:
06/11/2019
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
0.5

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.


Subtasks

Task #15352: Review 15350-pysdk-cookbook-recipeResolvedEric Biagiotti

Associated revisions

Revision fef85f35
Added by Lucas Di Pentima 14 days ago

Merge branch '15350-pysdk-cookbook-recipe'
Closes #15350

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <>

History

#1 Updated by Lucas Di Pentima 14 days 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.

#2 Updated by Eric Biagiotti 14 days 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 the return c['state'] fall through to the end.
  • Can remove the last else in the elif c['state'] == 'Running' clause.

#3 Updated by Lucas Di Pentima 14 days 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 the return 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

#4 Updated by Lucas Di Pentima 14 days ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF