MCPcopy Create free account
hub / github.com/StackStorm/st2 / ExecutionResourceManager

Class ExecutionResourceManager

st2client/st2client/models/core.py:502–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500
501
502class ExecutionResourceManager(ResourceManager):
503 @add_auth_token_to_kwargs_from_env
504 def re_run(
505 self,
506 execution_id,
507 parameters=None,
508 tasks=None,
509 no_reset=None,
510 delay=0,
511 **kwargs,
512 ):
513 url = "/%s/%s/re_run" % (self.resource.get_url_path_name(), execution_id)
514
515 tasks = tasks or []
516 no_reset = no_reset or []
517
518 if list(set(no_reset) - set(tasks)):
519 raise ValueError(
520 "List of tasks to reset does not match the tasks to rerun."
521 )
522
523 data = {
524 "parameters": parameters or {},
525 "tasks": tasks,
526 "reset": list(set(tasks) - set(no_reset)),
527 "delay": delay,
528 }
529
530 response = self.client.post(url, data, **kwargs)
531 if response.status_code != http_client.OK:
532 self.handle_error(response)
533
534 instance = self.resource.deserialize(parse_api_response(response))
535 return instance
536
537 @add_auth_token_to_kwargs_from_env
538 def get_output(self, execution_id, output_type=None, **kwargs):
539 url = "/%s/%s/output" % (self.resource.get_url_path_name(), execution_id)
540
541 if output_type:
542 url += "?" + urllib.parse.urlencode({"output_type": output_type})
543
544 response = self.client.get(url, **kwargs)
545 if response.status_code != http_client.OK:
546 self.handle_error(response)
547
548 return response.text
549
550 @add_auth_token_to_kwargs_from_env
551 def get_result(self, execution_id, **kwargs):
552 url = "/%s/%s/result" % (self.resource.get_url_path_name(), execution_id)
553
554 response = self.client.get(url, **kwargs)
555 if response.status_code != http_client.OK:
556 self.handle_error(response)
557
558 return response.text
559

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected