dbos 0.23.0a3__py3-none-any.whl → 0.23.0a5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dbos might be problematic. Click here for more details.
- dbos/_core.py +2 -0
- dbos/_sys_db.py +39 -82
- dbos/_workflow_commands.py +73 -108
- dbos/cli/cli.py +41 -20
- {dbos-0.23.0a3.dist-info → dbos-0.23.0a5.dist-info}/METADATA +1 -1
- {dbos-0.23.0a3.dist-info → dbos-0.23.0a5.dist-info}/RECORD +9 -9
- {dbos-0.23.0a3.dist-info → dbos-0.23.0a5.dist-info}/WHEEL +0 -0
- {dbos-0.23.0a3.dist-info → dbos-0.23.0a5.dist-info}/entry_points.txt +0 -0
- {dbos-0.23.0a3.dist-info → dbos-0.23.0a5.dist-info}/licenses/LICENSE +0 -0
dbos/_core.py
CHANGED
dbos/_sys_db.py
CHANGED
|
@@ -68,17 +68,19 @@ class WorkflowStatusInternal(TypedDict):
|
|
|
68
68
|
name: str
|
|
69
69
|
class_name: Optional[str]
|
|
70
70
|
config_name: Optional[str]
|
|
71
|
+
authenticated_user: Optional[str]
|
|
72
|
+
assumed_role: Optional[str]
|
|
73
|
+
authenticated_roles: Optional[str] # JSON list of roles
|
|
71
74
|
output: Optional[str] # JSON (jsonpickle)
|
|
75
|
+
request: Optional[str] # JSON (jsonpickle)
|
|
72
76
|
error: Optional[str] # JSON (jsonpickle)
|
|
77
|
+
created_at: Optional[int] # Unix epoch timestamp in ms
|
|
78
|
+
updated_at: Optional[int] # Unix epoch timestamp in ms
|
|
79
|
+
queue_name: Optional[str]
|
|
73
80
|
executor_id: Optional[str]
|
|
74
81
|
app_version: Optional[str]
|
|
75
82
|
app_id: Optional[str]
|
|
76
|
-
request: Optional[str] # JSON (jsonpickle)
|
|
77
83
|
recovery_attempts: Optional[int]
|
|
78
|
-
authenticated_user: Optional[str]
|
|
79
|
-
assumed_role: Optional[str]
|
|
80
|
-
authenticated_roles: Optional[str] # JSON list of roles.
|
|
81
|
-
queue_name: Optional[str]
|
|
82
84
|
|
|
83
85
|
|
|
84
86
|
class RecordedResult(TypedDict):
|
|
@@ -104,19 +106,12 @@ class GetWorkflowsInput:
|
|
|
104
106
|
Structure for argument to `get_workflows` function.
|
|
105
107
|
|
|
106
108
|
This specifies the search criteria for workflow retrieval by `get_workflows`.
|
|
107
|
-
|
|
108
|
-
Attributes:
|
|
109
|
-
name(str): The name of the workflow function
|
|
110
|
-
authenticated_user(str): The name of the user who invoked the function
|
|
111
|
-
start_time(str): Beginning of search range for time of invocation, in ISO 8601 format
|
|
112
|
-
end_time(str): End of search range for time of invocation, in ISO 8601 format
|
|
113
|
-
status(str): Current status of the workflow invocation (see `WorkflowStatusString`)
|
|
114
|
-
application_version(str): Application version that invoked the workflow
|
|
115
|
-
limit(int): Limit on number of returned records
|
|
116
|
-
|
|
117
109
|
"""
|
|
118
110
|
|
|
119
111
|
def __init__(self) -> None:
|
|
112
|
+
self.workflow_ids: Optional[List[str]] = (
|
|
113
|
+
None # Search only in these workflow IDs
|
|
114
|
+
)
|
|
120
115
|
self.name: Optional[str] = None # The name of the workflow function
|
|
121
116
|
self.authenticated_user: Optional[str] = None # The user who ran the workflow.
|
|
122
117
|
self.start_time: Optional[str] = None # Timestamp in ISO 8601 format
|
|
@@ -128,14 +123,18 @@ class GetWorkflowsInput:
|
|
|
128
123
|
self.limit: Optional[int] = (
|
|
129
124
|
None # Return up to this many workflows IDs. IDs are ordered by workflow creation time.
|
|
130
125
|
)
|
|
126
|
+
self.offset: Optional[int] = (
|
|
127
|
+
None # Offset into the matching records for pagination
|
|
128
|
+
)
|
|
131
129
|
|
|
132
130
|
|
|
133
131
|
class GetQueuedWorkflowsInput(TypedDict):
|
|
134
|
-
queue_name: Optional[str]
|
|
135
|
-
status: Optional[str]
|
|
132
|
+
queue_name: Optional[str] # Get workflows belonging to this queue
|
|
133
|
+
status: Optional[str] # Get workflows with this status
|
|
136
134
|
start_time: Optional[str] # Timestamp in ISO 8601 format
|
|
137
135
|
end_time: Optional[str] # Timestamp in ISO 8601 format
|
|
138
136
|
limit: Optional[int] # Return up to this many workflows IDs.
|
|
137
|
+
offset: Optional[int] # Offset into the matching records for pagination
|
|
139
138
|
name: Optional[str] # The name of the workflow function
|
|
140
139
|
|
|
141
140
|
|
|
@@ -489,27 +488,33 @@ class SystemDatabase:
|
|
|
489
488
|
SystemSchema.workflow_status.c.assumed_role,
|
|
490
489
|
SystemSchema.workflow_status.c.queue_name,
|
|
491
490
|
SystemSchema.workflow_status.c.executor_id,
|
|
491
|
+
SystemSchema.workflow_status.c.created_at,
|
|
492
|
+
SystemSchema.workflow_status.c.updated_at,
|
|
493
|
+
SystemSchema.workflow_status.c.application_version,
|
|
494
|
+
SystemSchema.workflow_status.c.application_id,
|
|
492
495
|
).where(SystemSchema.workflow_status.c.workflow_uuid == workflow_uuid)
|
|
493
496
|
).fetchone()
|
|
494
497
|
if row is None:
|
|
495
498
|
return None
|
|
496
499
|
status: WorkflowStatusInternal = {
|
|
497
500
|
"workflow_uuid": workflow_uuid,
|
|
498
|
-
"status": row[0],
|
|
499
|
-
"name": row[1],
|
|
500
|
-
"class_name": row[5],
|
|
501
|
-
"config_name": row[4],
|
|
502
501
|
"output": None,
|
|
503
502
|
"error": None,
|
|
504
|
-
"
|
|
505
|
-
"
|
|
506
|
-
"executor_id": row[10],
|
|
503
|
+
"status": row[0],
|
|
504
|
+
"name": row[1],
|
|
507
505
|
"request": row[2],
|
|
508
506
|
"recovery_attempts": row[3],
|
|
507
|
+
"config_name": row[4],
|
|
508
|
+
"class_name": row[5],
|
|
509
509
|
"authenticated_user": row[6],
|
|
510
510
|
"authenticated_roles": row[7],
|
|
511
511
|
"assumed_role": row[8],
|
|
512
512
|
"queue_name": row[9],
|
|
513
|
+
"executor_id": row[10],
|
|
514
|
+
"created_at": row[11],
|
|
515
|
+
"updated_at": row[12],
|
|
516
|
+
"app_version": row[13],
|
|
517
|
+
"app_id": row[14],
|
|
513
518
|
}
|
|
514
519
|
return status
|
|
515
520
|
|
|
@@ -538,47 +543,6 @@ class SystemDatabase:
|
|
|
538
543
|
)
|
|
539
544
|
return stat
|
|
540
545
|
|
|
541
|
-
def get_workflow_status_w_outputs(
|
|
542
|
-
self, workflow_uuid: str
|
|
543
|
-
) -> Optional[WorkflowStatusInternal]:
|
|
544
|
-
with self.engine.begin() as c:
|
|
545
|
-
row = c.execute(
|
|
546
|
-
sa.select(
|
|
547
|
-
SystemSchema.workflow_status.c.status,
|
|
548
|
-
SystemSchema.workflow_status.c.name,
|
|
549
|
-
SystemSchema.workflow_status.c.request,
|
|
550
|
-
SystemSchema.workflow_status.c.output,
|
|
551
|
-
SystemSchema.workflow_status.c.error,
|
|
552
|
-
SystemSchema.workflow_status.c.config_name,
|
|
553
|
-
SystemSchema.workflow_status.c.class_name,
|
|
554
|
-
SystemSchema.workflow_status.c.authenticated_user,
|
|
555
|
-
SystemSchema.workflow_status.c.authenticated_roles,
|
|
556
|
-
SystemSchema.workflow_status.c.assumed_role,
|
|
557
|
-
SystemSchema.workflow_status.c.queue_name,
|
|
558
|
-
).where(SystemSchema.workflow_status.c.workflow_uuid == workflow_uuid)
|
|
559
|
-
).fetchone()
|
|
560
|
-
if row is None:
|
|
561
|
-
return None
|
|
562
|
-
status: WorkflowStatusInternal = {
|
|
563
|
-
"workflow_uuid": workflow_uuid,
|
|
564
|
-
"status": row[0],
|
|
565
|
-
"name": row[1],
|
|
566
|
-
"config_name": row[5],
|
|
567
|
-
"class_name": row[6],
|
|
568
|
-
"output": row[3],
|
|
569
|
-
"error": row[4],
|
|
570
|
-
"app_id": None,
|
|
571
|
-
"app_version": None,
|
|
572
|
-
"executor_id": None,
|
|
573
|
-
"request": row[2],
|
|
574
|
-
"recovery_attempts": None,
|
|
575
|
-
"authenticated_user": row[7],
|
|
576
|
-
"authenticated_roles": row[8],
|
|
577
|
-
"assumed_role": row[9],
|
|
578
|
-
"queue_name": row[10],
|
|
579
|
-
}
|
|
580
|
-
return status
|
|
581
|
-
|
|
582
546
|
def await_workflow_result_internal(self, workflow_uuid: str) -> dict[str, Any]:
|
|
583
547
|
polling_interval_secs: float = 1.000
|
|
584
548
|
|
|
@@ -625,21 +589,6 @@ class SystemDatabase:
|
|
|
625
589
|
raise _serialization.deserialize_exception(stat["error"])
|
|
626
590
|
return None
|
|
627
591
|
|
|
628
|
-
def get_workflow_info(
|
|
629
|
-
self, workflow_uuid: str, get_request: bool
|
|
630
|
-
) -> Optional[WorkflowInformation]:
|
|
631
|
-
stat = self.get_workflow_status_w_outputs(workflow_uuid)
|
|
632
|
-
if stat is None:
|
|
633
|
-
return None
|
|
634
|
-
info = cast(WorkflowInformation, stat)
|
|
635
|
-
input = self.get_workflow_inputs(workflow_uuid)
|
|
636
|
-
if input is not None:
|
|
637
|
-
info["input"] = input
|
|
638
|
-
if not get_request:
|
|
639
|
-
info.pop("request", None)
|
|
640
|
-
|
|
641
|
-
return info
|
|
642
|
-
|
|
643
592
|
def update_workflow_inputs(
|
|
644
593
|
self, workflow_uuid: str, inputs: str, conn: Optional[sa.Connection] = None
|
|
645
594
|
) -> None:
|
|
@@ -715,14 +664,20 @@ class SystemDatabase:
|
|
|
715
664
|
SystemSchema.workflow_status.c.application_version
|
|
716
665
|
== input.application_version
|
|
717
666
|
)
|
|
667
|
+
if input.workflow_ids:
|
|
668
|
+
query = query.where(
|
|
669
|
+
SystemSchema.workflow_status.c.workflow_uuid.in_(input.workflow_ids)
|
|
670
|
+
)
|
|
718
671
|
if input.limit:
|
|
719
672
|
query = query.limit(input.limit)
|
|
673
|
+
if input.offset:
|
|
674
|
+
query = query.offset(input.offset)
|
|
720
675
|
|
|
721
676
|
with self.engine.begin() as c:
|
|
722
677
|
rows = c.execute(query)
|
|
723
|
-
|
|
678
|
+
workflow_ids = [row[0] for row in rows]
|
|
724
679
|
|
|
725
|
-
return GetWorkflowsOutput(
|
|
680
|
+
return GetWorkflowsOutput(workflow_ids)
|
|
726
681
|
|
|
727
682
|
def get_queued_workflows(
|
|
728
683
|
self, input: GetQueuedWorkflowsInput
|
|
@@ -763,6 +718,8 @@ class SystemDatabase:
|
|
|
763
718
|
)
|
|
764
719
|
if input.get("limit"):
|
|
765
720
|
query = query.limit(input["limit"])
|
|
721
|
+
if input.get("offset"):
|
|
722
|
+
query = query.offset(input["offset"])
|
|
766
723
|
|
|
767
724
|
with self.engine.begin() as c:
|
|
768
725
|
rows = c.execute(query)
|
dbos/_workflow_commands.py
CHANGED
|
@@ -4,6 +4,7 @@ import typer
|
|
|
4
4
|
|
|
5
5
|
from . import _serialization
|
|
6
6
|
from ._dbos_config import ConfigFile
|
|
7
|
+
from ._logger import dbos_logger
|
|
7
8
|
from ._sys_db import (
|
|
8
9
|
GetQueuedWorkflowsInput,
|
|
9
10
|
GetWorkflowsInput,
|
|
@@ -14,69 +15,65 @@ from ._sys_db import (
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class WorkflowInformation:
|
|
17
|
-
|
|
18
|
+
workflow_id: str
|
|
18
19
|
status: WorkflowStatuses
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
workflow_name: str
|
|
21
|
+
workflow_class_name: Optional[str]
|
|
22
|
+
workflow_config_name: Optional[str]
|
|
23
|
+
authenticated_user: Optional[str]
|
|
24
|
+
assumed_role: Optional[str]
|
|
25
|
+
authenticated_roles: Optional[str] # JSON list of roles.
|
|
22
26
|
input: Optional[_serialization.WorkflowInputs] # JSON (jsonpickle)
|
|
23
27
|
output: Optional[str] = None # JSON (jsonpickle)
|
|
28
|
+
request: Optional[str] # JSON (jsonpickle)
|
|
24
29
|
error: Optional[str] = None # JSON (jsonpickle)
|
|
30
|
+
created_at: Optional[int] # Unix epoch timestamp in ms
|
|
31
|
+
updated_at: Optional[int] # Unix epoch timestamp in ms
|
|
32
|
+
queue_name: Optional[str]
|
|
25
33
|
executor_id: Optional[str]
|
|
26
34
|
app_version: Optional[str]
|
|
27
35
|
app_id: Optional[str]
|
|
28
|
-
request: Optional[str] # JSON (jsonpickle)
|
|
29
36
|
recovery_attempts: Optional[int]
|
|
30
|
-
authenticated_user: Optional[str]
|
|
31
|
-
assumed_role: Optional[str]
|
|
32
|
-
authenticated_roles: Optional[str] # JSON list of roles.
|
|
33
|
-
queue_name: Optional[str]
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
def list_workflows(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
sys_db: SystemDatabase,
|
|
41
|
+
*,
|
|
42
|
+
workflow_ids: Optional[List[str]] = None,
|
|
43
|
+
user: Optional[str] = None,
|
|
44
|
+
start_time: Optional[str] = None,
|
|
45
|
+
end_time: Optional[str] = None,
|
|
46
|
+
status: Optional[str] = None,
|
|
47
|
+
request: bool = False,
|
|
48
|
+
app_version: Optional[str] = None,
|
|
49
|
+
name: Optional[str] = None,
|
|
50
|
+
limit: Optional[int] = None,
|
|
51
|
+
offset: Optional[int] = None,
|
|
46
52
|
) -> List[WorkflowInformation]:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
input.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if info is not None:
|
|
67
|
-
infos.append(info)
|
|
68
|
-
|
|
69
|
-
return infos
|
|
70
|
-
except Exception as e:
|
|
71
|
-
typer.echo(f"Error listing workflows: {e}")
|
|
72
|
-
return []
|
|
73
|
-
finally:
|
|
74
|
-
if sys_db:
|
|
75
|
-
sys_db.destroy()
|
|
53
|
+
input = GetWorkflowsInput()
|
|
54
|
+
input.workflow_ids = workflow_ids
|
|
55
|
+
input.authenticated_user = user
|
|
56
|
+
input.start_time = start_time
|
|
57
|
+
input.end_time = end_time
|
|
58
|
+
if status is not None:
|
|
59
|
+
input.status = cast(WorkflowStatuses, status)
|
|
60
|
+
input.application_version = app_version
|
|
61
|
+
input.limit = limit
|
|
62
|
+
input.name = name
|
|
63
|
+
input.offset = offset
|
|
64
|
+
|
|
65
|
+
output: GetWorkflowsOutput = sys_db.get_workflows(input)
|
|
66
|
+
infos: List[WorkflowInformation] = []
|
|
67
|
+
for workflow_id in output.workflow_uuids:
|
|
68
|
+
info = get_workflow(sys_db, workflow_id, request) # Call the method for each ID
|
|
69
|
+
if info is not None:
|
|
70
|
+
infos.append(info)
|
|
71
|
+
return infos
|
|
76
72
|
|
|
77
73
|
|
|
78
74
|
def list_queued_workflows(
|
|
79
|
-
|
|
75
|
+
sys_db: SystemDatabase,
|
|
76
|
+
*,
|
|
80
77
|
limit: Optional[int] = None,
|
|
81
78
|
start_time: Optional[str] = None,
|
|
82
79
|
end_time: Optional[str] = None,
|
|
@@ -84,62 +81,27 @@ def list_queued_workflows(
|
|
|
84
81
|
status: Optional[str] = None,
|
|
85
82
|
name: Optional[str] = None,
|
|
86
83
|
request: bool = False,
|
|
84
|
+
offset: Optional[int] = None,
|
|
87
85
|
) -> List[WorkflowInformation]:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if info is not None:
|
|
105
|
-
infos.append(info)
|
|
106
|
-
return infos
|
|
107
|
-
except Exception as e:
|
|
108
|
-
typer.echo(f"Error listing workflows: {e}")
|
|
109
|
-
return []
|
|
110
|
-
finally:
|
|
111
|
-
if sys_db:
|
|
112
|
-
sys_db.destroy()
|
|
86
|
+
input: GetQueuedWorkflowsInput = {
|
|
87
|
+
"queue_name": queue_name,
|
|
88
|
+
"start_time": start_time,
|
|
89
|
+
"end_time": end_time,
|
|
90
|
+
"status": status,
|
|
91
|
+
"limit": limit,
|
|
92
|
+
"name": name,
|
|
93
|
+
"offset": offset,
|
|
94
|
+
}
|
|
95
|
+
output: GetWorkflowsOutput = sys_db.get_queued_workflows(input)
|
|
96
|
+
infos: List[WorkflowInformation] = []
|
|
97
|
+
for workflow_id in output.workflow_uuids:
|
|
98
|
+
info = get_workflow(sys_db, workflow_id, request) # Call the method for each ID
|
|
99
|
+
if info is not None:
|
|
100
|
+
infos.append(info)
|
|
101
|
+
return infos
|
|
113
102
|
|
|
114
103
|
|
|
115
104
|
def get_workflow(
|
|
116
|
-
config: ConfigFile, uuid: str, request: bool
|
|
117
|
-
) -> Optional[WorkflowInformation]:
|
|
118
|
-
try:
|
|
119
|
-
sys_db = SystemDatabase(config)
|
|
120
|
-
info = _get_workflow_info(sys_db, uuid, request)
|
|
121
|
-
return info
|
|
122
|
-
except Exception as e:
|
|
123
|
-
typer.echo(f"Error getting workflow: {e}")
|
|
124
|
-
return None
|
|
125
|
-
finally:
|
|
126
|
-
if sys_db:
|
|
127
|
-
sys_db.destroy()
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def cancel_workflow(config: ConfigFile, uuid: str) -> None:
|
|
131
|
-
try:
|
|
132
|
-
sys_db = SystemDatabase(config)
|
|
133
|
-
sys_db.cancel_workflow(uuid)
|
|
134
|
-
except Exception as e:
|
|
135
|
-
typer.echo(f"Failed to connect to DBOS system database: {e}")
|
|
136
|
-
raise e
|
|
137
|
-
finally:
|
|
138
|
-
if sys_db:
|
|
139
|
-
sys_db.destroy()
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def _get_workflow_info(
|
|
143
105
|
sys_db: SystemDatabase, workflowUUID: str, getRequest: bool
|
|
144
106
|
) -> Optional[WorkflowInformation]:
|
|
145
107
|
|
|
@@ -149,19 +111,22 @@ def _get_workflow_info(
|
|
|
149
111
|
|
|
150
112
|
winfo = WorkflowInformation()
|
|
151
113
|
|
|
152
|
-
winfo.
|
|
114
|
+
winfo.workflow_id = workflowUUID
|
|
153
115
|
winfo.status = info["status"]
|
|
154
|
-
winfo.
|
|
155
|
-
winfo.
|
|
156
|
-
winfo.
|
|
157
|
-
winfo.executor_id = info["executor_id"]
|
|
158
|
-
winfo.app_version = info["app_version"]
|
|
159
|
-
winfo.app_id = info["app_id"]
|
|
160
|
-
winfo.recovery_attempts = info["recovery_attempts"]
|
|
116
|
+
winfo.workflow_name = info["name"]
|
|
117
|
+
winfo.workflow_class_name = info["class_name"]
|
|
118
|
+
winfo.workflow_config_name = info["config_name"]
|
|
161
119
|
winfo.authenticated_user = info["authenticated_user"]
|
|
162
120
|
winfo.assumed_role = info["assumed_role"]
|
|
163
121
|
winfo.authenticated_roles = info["authenticated_roles"]
|
|
122
|
+
winfo.request = info["request"]
|
|
123
|
+
winfo.created_at = info["created_at"]
|
|
124
|
+
winfo.updated_at = info["updated_at"]
|
|
164
125
|
winfo.queue_name = info["queue_name"]
|
|
126
|
+
winfo.executor_id = info["executor_id"]
|
|
127
|
+
winfo.app_version = info["app_version"]
|
|
128
|
+
winfo.app_id = info["app_id"]
|
|
129
|
+
winfo.recovery_attempts = info["recovery_attempts"]
|
|
165
130
|
|
|
166
131
|
# no input field
|
|
167
132
|
input_data = sys_db.get_workflow_inputs(workflowUUID)
|
dbos/cli/cli.py
CHANGED
|
@@ -19,12 +19,7 @@ from .. import load_config
|
|
|
19
19
|
from .._app_db import ApplicationDatabase
|
|
20
20
|
from .._dbos_config import _is_valid_app_name
|
|
21
21
|
from .._sys_db import SystemDatabase, reset_system_database
|
|
22
|
-
from .._workflow_commands import
|
|
23
|
-
cancel_workflow,
|
|
24
|
-
get_workflow,
|
|
25
|
-
list_queued_workflows,
|
|
26
|
-
list_workflows,
|
|
27
|
-
)
|
|
22
|
+
from .._workflow_commands import get_workflow, list_queued_workflows, list_workflows
|
|
28
23
|
from ..cli._github_init import create_template_from_github
|
|
29
24
|
from ._template_init import copy_template, get_project_name, get_templates_directory
|
|
30
25
|
|
|
@@ -290,25 +285,37 @@ def list(
|
|
|
290
285
|
request: Annotated[
|
|
291
286
|
bool,
|
|
292
287
|
typer.Option("--request", help="Retrieve workflow request information"),
|
|
293
|
-
] =
|
|
288
|
+
] = False,
|
|
294
289
|
) -> None:
|
|
295
290
|
config = load_config(silent=True)
|
|
291
|
+
sys_db = SystemDatabase(config)
|
|
296
292
|
workflows = list_workflows(
|
|
297
|
-
|
|
293
|
+
sys_db,
|
|
294
|
+
limit=limit,
|
|
295
|
+
user=user,
|
|
296
|
+
start_time=starttime,
|
|
297
|
+
end_time=endtime,
|
|
298
|
+
status=status,
|
|
299
|
+
request=request,
|
|
300
|
+
app_version=appversion,
|
|
301
|
+
name=name,
|
|
298
302
|
)
|
|
299
303
|
print(jsonpickle.encode(workflows, unpicklable=False))
|
|
300
304
|
|
|
301
305
|
|
|
302
306
|
@workflow.command(help="Retrieve the status of a workflow")
|
|
303
307
|
def get(
|
|
304
|
-
|
|
308
|
+
workflow_id: Annotated[str, typer.Argument()],
|
|
305
309
|
request: Annotated[
|
|
306
310
|
bool,
|
|
307
311
|
typer.Option("--request", help="Retrieve workflow request information"),
|
|
308
|
-
] =
|
|
312
|
+
] = False,
|
|
309
313
|
) -> None:
|
|
310
314
|
config = load_config(silent=True)
|
|
311
|
-
|
|
315
|
+
sys_db = SystemDatabase(config)
|
|
316
|
+
print(
|
|
317
|
+
jsonpickle.encode(get_workflow(sys_db, workflow_id, request), unpicklable=False)
|
|
318
|
+
)
|
|
312
319
|
|
|
313
320
|
|
|
314
321
|
@workflow.command(
|
|
@@ -316,10 +323,23 @@ def get(
|
|
|
316
323
|
)
|
|
317
324
|
def cancel(
|
|
318
325
|
uuid: Annotated[str, typer.Argument()],
|
|
326
|
+
host: Annotated[
|
|
327
|
+
typing.Optional[str],
|
|
328
|
+
typer.Option("--host", "-H", help="Specify the admin host"),
|
|
329
|
+
] = "localhost",
|
|
330
|
+
port: Annotated[
|
|
331
|
+
typing.Optional[int],
|
|
332
|
+
typer.Option("--port", "-p", help="Specify the admin port"),
|
|
333
|
+
] = 3001,
|
|
319
334
|
) -> None:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
335
|
+
response = requests.post(
|
|
336
|
+
f"http://{host}:{port}/workflows/{uuid}/cancel", json=[], timeout=5
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
if response.status_code == 204:
|
|
340
|
+
print(f"Workflow {uuid} has been cancelled")
|
|
341
|
+
else:
|
|
342
|
+
print(f"Failed to cancel workflow {uuid}. Status code: {response.status_code}")
|
|
323
343
|
|
|
324
344
|
|
|
325
345
|
@workflow.command(help="Resume a workflow that has been cancelled")
|
|
@@ -327,7 +347,7 @@ def resume(
|
|
|
327
347
|
uuid: Annotated[str, typer.Argument()],
|
|
328
348
|
host: Annotated[
|
|
329
349
|
typing.Optional[str],
|
|
330
|
-
typer.Option("--host", "-
|
|
350
|
+
typer.Option("--host", "-H", help="Specify the admin host"),
|
|
331
351
|
] = "localhost",
|
|
332
352
|
port: Annotated[
|
|
333
353
|
typing.Optional[int],
|
|
@@ -338,7 +358,7 @@ def resume(
|
|
|
338
358
|
f"http://{host}:{port}/workflows/{uuid}/resume", json=[], timeout=5
|
|
339
359
|
)
|
|
340
360
|
|
|
341
|
-
if response.status_code ==
|
|
361
|
+
if response.status_code == 204:
|
|
342
362
|
print(f"Workflow {uuid} has been resumed")
|
|
343
363
|
else:
|
|
344
364
|
print(f"Failed to resume workflow {uuid}. Status code: {response.status_code}")
|
|
@@ -349,7 +369,7 @@ def restart(
|
|
|
349
369
|
uuid: Annotated[str, typer.Argument()],
|
|
350
370
|
host: Annotated[
|
|
351
371
|
typing.Optional[str],
|
|
352
|
-
typer.Option("--host", "-
|
|
372
|
+
typer.Option("--host", "-H", help="Specify the admin host"),
|
|
353
373
|
] = "localhost",
|
|
354
374
|
port: Annotated[
|
|
355
375
|
typing.Optional[int],
|
|
@@ -360,7 +380,7 @@ def restart(
|
|
|
360
380
|
f"http://{host}:{port}/workflows/{uuid}/restart", json=[], timeout=5
|
|
361
381
|
)
|
|
362
382
|
|
|
363
|
-
if response.status_code ==
|
|
383
|
+
if response.status_code == 204:
|
|
364
384
|
print(f"Workflow {uuid} has been restarted")
|
|
365
385
|
else:
|
|
366
386
|
print(f"Failed to resume workflow {uuid}. Status code: {response.status_code}")
|
|
@@ -415,11 +435,12 @@ def list_queue(
|
|
|
415
435
|
request: Annotated[
|
|
416
436
|
bool,
|
|
417
437
|
typer.Option("--request", help="Retrieve workflow request information"),
|
|
418
|
-
] =
|
|
438
|
+
] = False,
|
|
419
439
|
) -> None:
|
|
420
440
|
config = load_config(silent=True)
|
|
441
|
+
sys_db = SystemDatabase(config)
|
|
421
442
|
workflows = list_queued_workflows(
|
|
422
|
-
|
|
443
|
+
sys_db=sys_db,
|
|
423
444
|
limit=limit,
|
|
424
445
|
start_time=start_time,
|
|
425
446
|
end_time=end_time,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
dbos-0.23.
|
|
2
|
-
dbos-0.23.
|
|
3
|
-
dbos-0.23.
|
|
4
|
-
dbos-0.23.
|
|
1
|
+
dbos-0.23.0a5.dist-info/METADATA,sha256=saWbNoKPc4hy7CWVchMo64BhlRX3rBrl8q49PC4GCAY,5309
|
|
2
|
+
dbos-0.23.0a5.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
3
|
+
dbos-0.23.0a5.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
|
4
|
+
dbos-0.23.0a5.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
|
5
5
|
dbos/__init__.py,sha256=CxRHBHEthPL4PZoLbZhp3rdm44-KkRTT2-7DkK9d4QQ,724
|
|
6
6
|
dbos/_admin_server.py,sha256=YiVn5lywz2Vg8_juyNHOYl0HVEy48--7b4phwK7r92o,5732
|
|
7
7
|
dbos/_app_db.py,sha256=_tv2vmPjjiaikwgxH3mqxgJ4nUUcG2-0uMXKWCqVu1c,5509
|
|
@@ -10,7 +10,7 @@ dbos/_cloudutils/authentication.py,sha256=V0fCWQN9stCkhbuuxgPTGpvuQcDqfU3KAxPAh0
|
|
|
10
10
|
dbos/_cloudutils/cloudutils.py,sha256=YC7jGsIopT0KveLsqbRpQk2KlRBk-nIRC_UCgep4f3o,7797
|
|
11
11
|
dbos/_cloudutils/databases.py,sha256=_shqaqSvhY4n2ScgQ8IP5PDZvzvcx3YBKV8fj-cxhSY,8543
|
|
12
12
|
dbos/_context.py,sha256=Ue5qu3rzLfRmPkz-UUZi9ZS8iXpapRN0NTM4mbA2QmQ,17738
|
|
13
|
-
dbos/_core.py,sha256=
|
|
13
|
+
dbos/_core.py,sha256=MWIa8r-KwnadYQtGSod2KdAaeQ4gTJAUMPhMGaM0u2c,36613
|
|
14
14
|
dbos/_croniter.py,sha256=hbhgfsHBqclUS8VeLnJ9PSE9Z54z6mi4nnrr1aUXn0k,47561
|
|
15
15
|
dbos/_db_wizard.py,sha256=6tfJaCRa1NtkUdNW75a2yvi_mEgnPJ9C1HP2zPG1hCU,8067
|
|
16
16
|
dbos/_dbos.py,sha256=JNAFYQ3kVjnZsUl0qJ-JWeaSHKI51VGE3JBXdaPD8Oo,39054
|
|
@@ -41,7 +41,7 @@ dbos/_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
41
41
|
dbos/_schemas/application_database.py,sha256=KeyoPrF7hy_ODXV7QNike_VFSD74QBRfQ76D7QyE9HI,966
|
|
42
42
|
dbos/_schemas/system_database.py,sha256=rwp4EvCSaXcUoMaRczZCvETCxGp72k3-hvLyGUDkih0,5163
|
|
43
43
|
dbos/_serialization.py,sha256=YCYv0qKAwAZ1djZisBC7khvKqG-5OcIv9t9EC5PFIog,1743
|
|
44
|
-
dbos/_sys_db.py,sha256=
|
|
44
|
+
dbos/_sys_db.py,sha256=tyBQicOkkf563CU83MwZubENpI5AmCYFyz2tSbQ9XQ4,61045
|
|
45
45
|
dbos/_templates/dbos-db-starter/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
|
|
46
46
|
dbos/_templates/dbos-db-starter/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
47
|
dbos/_templates/dbos-db-starter/__package/main.py,sha256=eI0SS9Nwj-fldtiuSzIlIG6dC91GXXwdRsoHxv6S_WI,2719
|
|
@@ -54,11 +54,11 @@ dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py,sh
|
|
|
54
54
|
dbos/_templates/dbos-db-starter/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
|
|
55
55
|
dbos/_tracer.py,sha256=_Id9j9kCrptSNpEpLiRk_g5VPp-DrTWP1WNZInd5BA4,2439
|
|
56
56
|
dbos/_utils.py,sha256=wjOJzxN66IzL9p4dwcEmQACRQah_V09G6mJI2exQfOM,155
|
|
57
|
-
dbos/_workflow_commands.py,sha256=
|
|
57
|
+
dbos/_workflow_commands.py,sha256=ZAdVccVuSFlcZ_kEdo6MwQ9xaslVXn_MMRTybJlkyQw,4652
|
|
58
58
|
dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
|
|
59
59
|
dbos/cli/_template_init.py,sha256=AfuMaO8bmr9WsPNHr6j2cp7kjVVZDUpH7KpbTg0hhFs,2722
|
|
60
|
-
dbos/cli/cli.py,sha256=
|
|
60
|
+
dbos/cli/cli.py,sha256=BJWFT94I14uKTmMYSI4ITscPMBgidgjV0RBx5_LyNKI,14849
|
|
61
61
|
dbos/dbos-config.schema.json,sha256=X5TpXNcARGceX0zQs0fVgtZW_Xj9uBbY5afPt9Rz9yk,5741
|
|
62
62
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
|
63
63
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
|
64
|
-
dbos-0.23.
|
|
64
|
+
dbos-0.23.0a5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|