-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathset_stack_state.py
More file actions
41 lines (35 loc) · 1.36 KB
/
Copy pathset_stack_state.py
File metadata and controls
41 lines (35 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import renderapi
from ..module.render_module import RenderModule, RenderParameters
from argschema.fields import Str, Int, List
example_json = {
"render": {
"host": "ibs-forrestc-ux1",
"port": 8080,
"owner": "6_ribbon_experiments",
"project": "M335503_Ai139_smallvol",
"client_scripts" : "/pipeline/render/render-ws-java-client/src/main/scripts"
},
"stack": "Rough_Aligned_Deconv_1_PSD95",
"state": "COMPLETE"
}
class SetStackStateParameters(RenderParameters):
stack = Str(required=False,default="",
description= 'stack to change state of')
state = Str(required=True, description = "State to set: LOADING or COMPLETE")
class SetStackState(RenderModule):
def __init__(self, schema_type=None, *args, **kwargs):
if schema_type is None:
schema_type = SetStackStateParameters
super(SetStackState, self).__init__(
schema_type=schema_type, *args, **kwargs)
def run(self):
if self.args['stack'] == "":
allstacks = renderapi.render.get_stacks_by_owner_project(render=self.render)
else:
allstacks = [self.args['stack'] ]
for stack in allstacks:
renderapi.stack.set_stack_state(stack, self.args['state'],
render=self.render)
if __name__ == "__main__":
mod = SetStackState(input_data=example_json)
mod.run()