Created
August 17, 2015 12:12
-
-
Save bmoussaud/81ce60ad1d78e77c61ad to your computer and use it in GitHub Desktop.
get steps information using the CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gather_steps_from_block(b, tid): | |
if hasattr(b, "blocks") and len(b.blocks): | |
for i in b.blocks: | |
return gather_steps_from_block(i, tid) | |
else: | |
step_block_state = task2.steps(tid, b.id) | |
step_index = 0 | |
step_ids = [] | |
for st in step_block_state.steps: | |
step_index += 1 | |
step_ids.append("%s_%s" % (b.id,step_index)) | |
return step_ids | |
def gather_steps_from_task(t): | |
step_ids = [] | |
for phase_block in t.block.blocks: | |
step_ids.extend(gather_steps_from_block(phase_block.block, t.id)) | |
return step_ids | |
task = task2.get("4c8a2cbe-35bc-451b-914d-0f41cbc337d1") | |
step_ids = gather_steps_from_task(task) | |
for step in step_ids: | |
complete_step=task2.step(task.id, step) | |
print " Description %s " % complete_step.description | |
print " State: %s " % complete_step.state | |
print " LOG: %s" % complete_step.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment