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

Class LiveActionDB

st2common/st2common/models/db/liveaction.py:40–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39
40class LiveActionDB(stormbase.StormFoundationDB):
41 workflow_execution = me.StringField()
42 task_execution = me.StringField()
43 # TODO: Can status be an enum at the Mongo layer?
44 status = me.StringField(
45 required=True, help_text="The current status of the liveaction."
46 )
47 start_timestamp = ComplexDateTimeField(
48 default=date_utils.get_datetime_utc_now,
49 help_text="The timestamp when the liveaction was created.",
50 )
51 end_timestamp = ComplexDateTimeField(
52 help_text="The timestamp when the liveaction has finished."
53 )
54 action = me.StringField(
55 required=True, help_text="Reference to the action that has to be executed."
56 )
57 action_is_workflow = me.BooleanField(
58 default=False,
59 help_text="A flag indicating whether the referenced action is a workflow.",
60 )
61 parameters = stormbase.EscapedDynamicField(
62 default={},
63 help_text="The key-value pairs passed as to the action runner & execution.",
64 )
65 result = JSONDictEscapedFieldCompatibilityField(
66 default={}, help_text="Action defined result."
67 )
68 context = me.DictField(
69 default={}, help_text="Contextual information on the action execution."
70 )
71 callback = me.DictField(
72 default={},
73 help_text="Callback information for the on completion of action execution.",
74 )
75 runner_info = me.DictField(
76 default={},
77 help_text="Information about the runner which executed this live action (hostname, pid).",
78 )
79 notify = me.EmbeddedDocumentField(NotificationSchema)
80 delay = me.IntField(
81 min_value=0,
82 help_text="How long (in milliseconds) to delay the execution before scheduling.",
83 )
84
85 meta = {
86 "indexes": [
87 {"fields": ["-start_timestamp", "action"]},
88 {"fields": ["start_timestamp"]},
89 {"fields": ["end_timestamp"]},
90 {"fields": ["action"]},
91 {"fields": ["status"]},
92 {"fields": ["context.trigger_instance.id"]},
93 {"fields": ["workflow_execution"]},
94 {"fields": ["task_execution"]},
95 ],
96 }
97