plexus-python-pulse-demeter 1.2.147__py3-none-any.whl → 1.2.149__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.
- plexus/pulse/demeter/domains/robotic/api/pipeline_endpoints.py +4 -2
- plexus/pulse/demeter/domains/robotic/cli/flow_ops.py +9 -0
- plexus/pulse/demeter/domains/robotic/cli/pipeline.py +13 -1
- plexus/pulse/demeter/domains/robotic/client.py +2 -0
- plexus/pulse/demeter/domains/robotic/sdk/flow.py +29 -0
- {plexus_python_pulse_demeter-1.2.147.dist-info → plexus_python_pulse_demeter-1.2.149.dist-info}/METADATA +1 -1
- {plexus_python_pulse_demeter-1.2.147.dist-info → plexus_python_pulse_demeter-1.2.149.dist-info}/RECORD +10 -10
- {plexus_python_pulse_demeter-1.2.147.dist-info → plexus_python_pulse_demeter-1.2.149.dist-info}/WHEEL +0 -0
- {plexus_python_pulse_demeter-1.2.147.dist-info → plexus_python_pulse_demeter-1.2.149.dist-info}/entry_points.txt +0 -0
- {plexus_python_pulse_demeter-1.2.147.dist-info → plexus_python_pulse_demeter-1.2.149.dist-info}/top_level.txt +0 -0
|
@@ -979,6 +979,7 @@ class CompleteUploadRequest(pdt.BaseModel):
|
|
|
979
979
|
content_id: str = pdt.Field(pattern=r"^[0-9a-f]{64}$")
|
|
980
980
|
config: dict
|
|
981
981
|
files: list[UploadedFile] = pdt.Field(min_length=1)
|
|
982
|
+
props: dict[str, str] = pdt.Field(default_factory=dict)
|
|
982
983
|
|
|
983
984
|
|
|
984
985
|
def upload_pipeline(db: sa_orm.Session, pipeline_name: str, stage: str) -> tuple[Flow, FlowUploadStage]:
|
|
@@ -1025,7 +1026,8 @@ def complete_upload(
|
|
|
1025
1026
|
content_id = (
|
|
1026
1027
|
hashlib
|
|
1027
1028
|
.sha256(json
|
|
1028
|
-
.dumps({"config": upload_stage.model_dump(), "files": files},
|
|
1029
|
+
.dumps({"config": upload_stage.model_dump(), "files": files, "props": request.props or {}},
|
|
1030
|
+
sort_keys=True)
|
|
1029
1031
|
.encode())
|
|
1030
1032
|
.hexdigest()
|
|
1031
1033
|
)
|
|
@@ -1036,7 +1038,7 @@ def complete_upload(
|
|
|
1036
1038
|
f"{upload_stage.config.scheme}://{upload_stage.config.bucket}/{upload_stage.config.prefix.rstrip('/')}/{request.upload_id}/{content_id}/"
|
|
1037
1039
|
)
|
|
1038
1040
|
dedup_key = hashlib.sha256(destination.encode()).hexdigest()
|
|
1039
|
-
data = {"path": destination}
|
|
1041
|
+
data = {"path": destination, "props": request.props}
|
|
1040
1042
|
|
|
1041
1043
|
current_dt = clock(db)
|
|
1042
1044
|
|
|
@@ -33,6 +33,7 @@ class FlowOpsCommandTool(CommandTool):
|
|
|
33
33
|
from pathlib import Path
|
|
34
34
|
|
|
35
35
|
from plexus.pulse.demeter.domains.robotic.client import PipelineApiClient
|
|
36
|
+
from plexus.pulse.demeter.domains.robotic.sdk.flow import write_output_params
|
|
36
37
|
|
|
37
38
|
work_path = Path(os.environ.get("WORKSPACE_DIR", "/workspace")) / os.environ["ARGO_WORKFLOW_UID"]
|
|
38
39
|
api_client = PipelineApiClient(args.api_url)
|
|
@@ -50,10 +51,18 @@ class FlowOpsCommandTool(CommandTool):
|
|
|
50
51
|
argo_namespace=os.environ["ARGO_WORKFLOW_NAMESPACE"],
|
|
51
52
|
**options,
|
|
52
53
|
)
|
|
54
|
+
from plexus.pulse.demeter.domains.robotic.capsule import Capsule
|
|
55
|
+
|
|
56
|
+
with Capsule(work_path, read_only=True) as capsule:
|
|
57
|
+
write_output_params(initialized=True, has_stage_inputs=bool(capsule.stage_inputs()))
|
|
58
|
+
|
|
53
59
|
elif args.operation == "heartbeat":
|
|
54
60
|
api_client.heartbeat(work_path)
|
|
61
|
+
|
|
55
62
|
elif args.operation == "finalize":
|
|
56
63
|
api_client.finalize(work_path, os.environ["ARGO_WORKFLOW_STATUS"])
|
|
64
|
+
|
|
57
65
|
else:
|
|
58
66
|
raise ValueError("unrecognized operation")
|
|
67
|
+
|
|
59
68
|
return 0
|
|
@@ -50,6 +50,10 @@ class PipelineUploadCommandTool(CommandTool):
|
|
|
50
50
|
click.Option(["--upload-id"],
|
|
51
51
|
type=click.UUID,
|
|
52
52
|
help="Reuse the ID printed by an earlier failed registration."),
|
|
53
|
+
click.Option(["--props"],
|
|
54
|
+
multiple=True,
|
|
55
|
+
metavar="KEY=VALUE",
|
|
56
|
+
help="Add string properties to stage output data; repeat as needed."),
|
|
53
57
|
]
|
|
54
58
|
|
|
55
59
|
@classmethod
|
|
@@ -157,6 +161,13 @@ def run(args: SimpleNamespace) -> int:
|
|
|
157
161
|
if not source.is_dir():
|
|
158
162
|
raise click.UsageError(f"source '{source}' must be a directory")
|
|
159
163
|
|
|
164
|
+
props = {}
|
|
165
|
+
for item in getattr(args, "props", ()):
|
|
166
|
+
key, separator, value = item.partition("=")
|
|
167
|
+
if not separator or not key:
|
|
168
|
+
raise click.UsageError("'--props' requires KEY=VALUE and keys must be nonempty")
|
|
169
|
+
props[key] = value
|
|
170
|
+
|
|
160
171
|
upload_id = None
|
|
161
172
|
try:
|
|
162
173
|
if args.list_stages:
|
|
@@ -187,7 +198,7 @@ def run(args: SimpleNamespace) -> int:
|
|
|
187
198
|
# Bind retries to the file contents and the complete stage configuration.
|
|
188
199
|
content_id = (
|
|
189
200
|
hashlib
|
|
190
|
-
.sha256(json.dumps({"config": stage, "files": manifest}, sort_keys=True).encode())
|
|
201
|
+
.sha256(json.dumps({"config": stage, "files": manifest, "props": props or {}}, sort_keys=True).encode())
|
|
191
202
|
.hexdigest()
|
|
192
203
|
)
|
|
193
204
|
upload_id = str(args.upload_id or py_uuid.uuid4())
|
|
@@ -248,6 +259,7 @@ def run(args: SimpleNamespace) -> int:
|
|
|
248
259
|
content_id=content_id,
|
|
249
260
|
config=stage,
|
|
250
261
|
files=manifest,
|
|
262
|
+
props=props,
|
|
251
263
|
)
|
|
252
264
|
console.print(f"Uploaded {len(files)} file(s); registered {len(result['stage_inputs'])} stage input(s).",
|
|
253
265
|
style="bold green")
|
|
@@ -62,6 +62,7 @@ class PipelineApiClient(object):
|
|
|
62
62
|
content_id: str,
|
|
63
63
|
config: dict,
|
|
64
64
|
files: list[dict],
|
|
65
|
+
props: dict[str, str] | None = None,
|
|
65
66
|
) -> JsonObject:
|
|
66
67
|
try:
|
|
67
68
|
with self.session.post(
|
|
@@ -73,6 +74,7 @@ class PipelineApiClient(object):
|
|
|
73
74
|
"content_id": content_id,
|
|
74
75
|
"config": config,
|
|
75
76
|
"files": files,
|
|
77
|
+
"props": props,
|
|
76
78
|
},
|
|
77
79
|
timeout=60,
|
|
78
80
|
) as response:
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import textcase
|
|
5
|
+
from plexus.pulse.common.utils.datautils import validate_snake_case
|
|
6
|
+
|
|
1
7
|
from plexus.pulse.demeter.domains.robotic.capsule import Capsule
|
|
2
8
|
from plexus.pulse.demeter.domains.robotic.capsule import capsule_default_filename, capsule_schema_version, get_capsule
|
|
3
9
|
from plexus.pulse.demeter.domains.robotic.models.capsule import (
|
|
@@ -24,4 +30,27 @@ __all__ = [
|
|
|
24
30
|
"capsule_default_filename",
|
|
25
31
|
"capsule_schema_version",
|
|
26
32
|
"get_capsule",
|
|
33
|
+
"write_output_params",
|
|
27
34
|
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def write_output_params(output_dir: str | os.PathLike[str] | None = None, **params: str | bool | int | float) -> None:
|
|
38
|
+
"""
|
|
39
|
+
Write named parameters under ``PULSE_DEMETER_OUTPUT_PARAMS``.
|
|
40
|
+
|
|
41
|
+
Snake_case keys become kebab-case filenames. Booleans are written as
|
|
42
|
+
lowercase true/false for workflow conditions. An explicit output_dir takes
|
|
43
|
+
precedence over the environment variable and default directory.
|
|
44
|
+
"""
|
|
45
|
+
if not params:
|
|
46
|
+
return
|
|
47
|
+
for name, value in params:
|
|
48
|
+
validate_snake_case(name)
|
|
49
|
+
|
|
50
|
+
output_dir = Path(output_dir if output_dir is not None
|
|
51
|
+
else os.environ.get("PULSE_DEMETER_OUTPUT_PARAMS", "/tmp/pulse-demeter-output-params"))
|
|
52
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
53
|
+
|
|
54
|
+
for name, value in params.items():
|
|
55
|
+
text = str(value).lower() if isinstance(value, bool) else str(value)
|
|
56
|
+
(output_dir / textcase.kebab(name)).write_text(text, encoding="utf-8")
|
|
@@ -29,23 +29,23 @@ plexus/pulse/demeter/domains/autodrive/tables/tagging.py,sha256=3WUK9qfuRxfldFb8
|
|
|
29
29
|
plexus/pulse/demeter/domains/autodrive/tables/workflow.py,sha256=pOmsuRPbjDudG5_zB1Jpoo0hihTQCLqAG7WwHTF_xhQ,7541
|
|
30
30
|
plexus/pulse/demeter/domains/robotic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
plexus/pulse/demeter/domains/robotic/capsule.py,sha256=Ydz_bAfUr9Kd_UDC0Upn_vP-ehULEoSGMXdsZQFQyT8,41481
|
|
32
|
-
plexus/pulse/demeter/domains/robotic/client.py,sha256=
|
|
32
|
+
plexus/pulse/demeter/domains/robotic/client.py,sha256=p_hI-zauLbMQxXY9QHjzX6FpGS2OHmnEWj8r_AuI6jQ,7262
|
|
33
33
|
plexus/pulse/demeter/domains/robotic/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
plexus/pulse/demeter/domains/robotic/api/catalog_endpoints.py,sha256=-5mJdiFbaFMjzTNUK_6OH6TErnrB29d4Vb5Vj1S8k4A,40576
|
|
35
35
|
plexus/pulse/demeter/domains/robotic/api/catalog_internal_endpoints.py,sha256=iPJ5jkhz7cTr0vnN1BaBjBszxsQ4UhxNbOzKV3nGk04,31291
|
|
36
|
-
plexus/pulse/demeter/domains/robotic/api/pipeline_endpoints.py,sha256=
|
|
36
|
+
plexus/pulse/demeter/domains/robotic/api/pipeline_endpoints.py,sha256=dPnePjtROvzbrYO2lPkNRqG5vZMWbTcRnibply20mF0,48959
|
|
37
37
|
plexus/pulse/demeter/domains/robotic/api/pipeline_internal_endpoints.py,sha256=AU8IUrbEiGOQv8o3E5r14Q6f9kEgHA3q8XVwrqgqq2Y,17723
|
|
38
38
|
plexus/pulse/demeter/domains/robotic/api/pipeline_metrics_endpoints.py,sha256=DGsABhXGJ_qg-rECu4paBOS1JpdkVV6prWsYstPzhV4,8560
|
|
39
39
|
plexus/pulse/demeter/domains/robotic/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
plexus/pulse/demeter/domains/robotic/cli/flow_ops.py,sha256=
|
|
41
|
-
plexus/pulse/demeter/domains/robotic/cli/pipeline.py,sha256=
|
|
40
|
+
plexus/pulse/demeter/domains/robotic/cli/flow_ops.py,sha256=wvGjkjEqo5p5P3qId9F-eMSvsFS7sjDcKWzprhobo28,2466
|
|
41
|
+
plexus/pulse/demeter/domains/robotic/cli/pipeline.py,sha256=OTSwRTIYN1ApIs3xlHoEOoBalfmlKGLXMpm-H4uQCHo,12980
|
|
42
42
|
plexus/pulse/demeter/domains/robotic/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
43
|
plexus/pulse/demeter/domains/robotic/models/capsule.py,sha256=7_eLgL_1W8Q1ujd3uBvMnygHxRT3FSgJiN6XbN0i74w,13179
|
|
44
44
|
plexus/pulse/demeter/domains/robotic/models/catalog.py,sha256=xJjugLs8NrfKK9dpe-VJRcanbZiQShyigXVta0dFWuA,52991
|
|
45
45
|
plexus/pulse/demeter/domains/robotic/models/flow.py,sha256=li8RKuvmtViEWnlmkLbQ46EB0mqleHZz4NJq4nIGrIg,6388
|
|
46
46
|
plexus/pulse/demeter/domains/robotic/models/pipeline.py,sha256=deRI3hG7Z4kfTRyQEb8X3BZ4RFjW4SW6JIT6aw_ET3M,19442
|
|
47
47
|
plexus/pulse/demeter/domains/robotic/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
plexus/pulse/demeter/domains/robotic/sdk/flow.py,sha256=
|
|
48
|
+
plexus/pulse/demeter/domains/robotic/sdk/flow.py,sha256=KWZvXYfS3bCEwVELdlUcpELWvtAFfwdP6DmOHJhjuak,1806
|
|
49
49
|
plexus/pulse/demeter/domains/robotic/sdk/oss.py,sha256=wMzHzRUZsU_p6P-qIGU7kTa4W1JV4bl7KPXk2SsVcwY,1874
|
|
50
50
|
plexus/pulse/demeter/domains/robotic/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
plexus/pulse/demeter/domains/robotic/tables/catalog.py,sha256=zmstfKKv2AB9kjuEu-d7kJ-dj_Z2_YjwgJZIKAbNshU,11482
|
|
@@ -62,8 +62,8 @@ plexus/pulse/demeter/platform/models/__init__.py,sha256=eDzE5DfmvnE1258XLGQir_K3
|
|
|
62
62
|
plexus/pulse/demeter/platform/models/iam.py,sha256=v7M6UCHoHekFbVK_shYXGln9R5DkO3Q070EtmIdRwf0,9713
|
|
63
63
|
plexus/pulse/demeter/platform/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
64
|
plexus/pulse/demeter/platform/tables/iam.py,sha256=K0Jaf0KIr9vKsmQ92n4_nh1ZJhN2Tr9l0JpiixBtFfg,10568
|
|
65
|
-
plexus_python_pulse_demeter-1.2.
|
|
66
|
-
plexus_python_pulse_demeter-1.2.
|
|
67
|
-
plexus_python_pulse_demeter-1.2.
|
|
68
|
-
plexus_python_pulse_demeter-1.2.
|
|
69
|
-
plexus_python_pulse_demeter-1.2.
|
|
65
|
+
plexus_python_pulse_demeter-1.2.149.dist-info/METADATA,sha256=VcdiukY4TmUEotFSaq17WjCQteDt2Gt8Jx_mLM83dVo,1805
|
|
66
|
+
plexus_python_pulse_demeter-1.2.149.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
67
|
+
plexus_python_pulse_demeter-1.2.149.dist-info/entry_points.txt,sha256=hJz_bf2aQIWXZTWbZIvtGQQNZFTQk-sro9leV_zHTdw,110
|
|
68
|
+
plexus_python_pulse_demeter-1.2.149.dist-info/top_level.txt,sha256=ug_g7CVwaMQuas5UzAXbHUrQvKGCn8ezc6ZNvvRlJOE,7
|
|
69
|
+
plexus_python_pulse_demeter-1.2.149.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|