truefoundry 0.3.0rc9__py3-none-any.whl → 0.3.0rc10__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 truefoundry might be problematic. Click here for more details.
- truefoundry/deploy/__init__.py +1 -0
- truefoundry/deploy/cli/cli.py +2 -0
- truefoundry/deploy/cli/commands/trigger_command.py +58 -0
- truefoundry/deploy/lib/clients/servicefoundry_client.py +6 -0
- truefoundry/deploy/lib/dao/application.py +20 -0
- {truefoundry-0.3.0rc9.dist-info → truefoundry-0.3.0rc10.dist-info}/METADATA +2 -2
- {truefoundry-0.3.0rc9.dist-info → truefoundry-0.3.0rc10.dist-info}/RECORD +9 -9
- {truefoundry-0.3.0rc9.dist-info → truefoundry-0.3.0rc10.dist-info}/WHEEL +0 -0
- {truefoundry-0.3.0rc9.dist-info → truefoundry-0.3.0rc10.dist-info}/entry_points.txt +0 -0
truefoundry/deploy/__init__.py
CHANGED
truefoundry/deploy/cli/cli.py
CHANGED
|
@@ -13,6 +13,7 @@ from truefoundry.deploy.cli.commands import (
|
|
|
13
13
|
get_logout_command,
|
|
14
14
|
get_patch_application_command,
|
|
15
15
|
get_patch_command,
|
|
16
|
+
get_trigger_command,
|
|
16
17
|
)
|
|
17
18
|
from truefoundry.deploy.cli.config import CliConfig
|
|
18
19
|
from truefoundry.deploy.cli.const import GROUP_CLS
|
|
@@ -36,6 +37,7 @@ def create_truefoundry_cli():
|
|
|
36
37
|
cli.add_command(get_deploy_command())
|
|
37
38
|
cli.add_command(get_patch_application_command())
|
|
38
39
|
cli.add_command(get_delete_command())
|
|
40
|
+
cli.add_command(get_trigger_command())
|
|
39
41
|
|
|
40
42
|
if not (sys.platform.startswith("win32") or sys.platform.startswith("cygwin")):
|
|
41
43
|
cli.add_command(get_patch_command())
|
|
@@ -82,6 +82,64 @@ def trigger_job(application_fqn: str, command: Optional[Sequence[str]], params):
|
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
@click.command(
|
|
86
|
+
name="workflow",
|
|
87
|
+
cls=COMMAND_CLS,
|
|
88
|
+
context_settings={"ignore_unknown_options": True, "allow_extra_args": True},
|
|
89
|
+
)
|
|
90
|
+
@click.option(
|
|
91
|
+
"--application-fqn",
|
|
92
|
+
"--application_fqn",
|
|
93
|
+
type=click.STRING,
|
|
94
|
+
required=True,
|
|
95
|
+
help="FQN of the workflow application",
|
|
96
|
+
)
|
|
97
|
+
@click.argument(
|
|
98
|
+
"inputs",
|
|
99
|
+
type=click.STRING,
|
|
100
|
+
nargs=-1,
|
|
101
|
+
required=False,
|
|
102
|
+
)
|
|
103
|
+
@handle_exception_wrapper
|
|
104
|
+
def trigger_workflow(application_fqn: str, inputs):
|
|
105
|
+
"""
|
|
106
|
+
Trigger a Workflow on TrueFoundry
|
|
107
|
+
|
|
108
|
+
[b]tfy trigger workflow --application-fqn "my-cluster:my-workspace:my-workflow"[/]
|
|
109
|
+
|
|
110
|
+
\n
|
|
111
|
+
Additionally, you can pass inputs (if defined in the workflow)\n\n
|
|
112
|
+
|
|
113
|
+
Passing inputs:
|
|
114
|
+
|
|
115
|
+
[b]tfy trigger workflow --application-fqn "my-cluster:my-workspace:my-workflow" -- --input1_name input1_value --input2_name input2_value ...[/]
|
|
116
|
+
"""
|
|
117
|
+
if inputs:
|
|
118
|
+
inputs_dict = {}
|
|
119
|
+
if len(inputs) % 2 != 0:
|
|
120
|
+
raise ClickException(
|
|
121
|
+
f"Found odd number of argument pairs: {inputs}. "
|
|
122
|
+
"Perhaps you forgot to pass a value for one of the inputs? "
|
|
123
|
+
"inputs for workflow should be passed in the "
|
|
124
|
+
"format `--input1_name input1_value --input2_name input2_value ...`"
|
|
125
|
+
)
|
|
126
|
+
for i in range(0, len(inputs), 2):
|
|
127
|
+
key = inputs[i]
|
|
128
|
+
value = inputs[i + 1]
|
|
129
|
+
if not key.startswith("--"):
|
|
130
|
+
raise ClickException(
|
|
131
|
+
f"Got ambiguous argument {key!r} in inputs: {inputs}. "
|
|
132
|
+
f"input names should be prefixed with '--' i.e. "
|
|
133
|
+
"inputs for workflow should be passed in the "
|
|
134
|
+
"format `--input1_name input1_value --input2_name input2_value ...`"
|
|
135
|
+
)
|
|
136
|
+
key = key.lstrip("-")
|
|
137
|
+
inputs_dict[key] = value
|
|
138
|
+
|
|
139
|
+
application.trigger_workflow(application_fqn=application_fqn, inputs=inputs)
|
|
140
|
+
|
|
141
|
+
|
|
85
142
|
def get_trigger_command():
|
|
86
143
|
trigger_command.add_command(trigger_job)
|
|
144
|
+
trigger_command.add_command(trigger_workflow)
|
|
87
145
|
return trigger_command
|
|
@@ -616,6 +616,12 @@ class ServiceFoundryServiceClient:
|
|
|
616
616
|
response = request_handling(res)
|
|
617
617
|
return TriggerJobResult.parse_obj(response)
|
|
618
618
|
|
|
619
|
+
def trigger_workflow(self, application_id: str, inputs: Dict[str, Any]):
|
|
620
|
+
url = f"{self._api_server_url}/{VERSION_PREFIX}/workflow/{application_id}/executions"
|
|
621
|
+
res = requests.post(url, json=inputs, headers=self._get_header())
|
|
622
|
+
response = request_handling(res)
|
|
623
|
+
return response
|
|
624
|
+
|
|
619
625
|
@check_min_cli_version
|
|
620
626
|
def get_docker_registry_creds(
|
|
621
627
|
self, docker_registry_fqn: str, cluster_id: str
|
|
@@ -241,3 +241,23 @@ def terminate_job_run(
|
|
|
241
241
|
job_run_name=job_run_name,
|
|
242
242
|
)
|
|
243
243
|
return response
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def trigger_workflow(application_fqn: str, inputs: Optional[Dict[str, Any]] = None):
|
|
247
|
+
inputs = inputs or {}
|
|
248
|
+
client = ServiceFoundryServiceClient()
|
|
249
|
+
_application_info = client.get_application_info_by_fqn(
|
|
250
|
+
application_fqn=application_fqn
|
|
251
|
+
)
|
|
252
|
+
application_info = client.get_application_info(
|
|
253
|
+
application_id=_application_info.applicationId
|
|
254
|
+
)
|
|
255
|
+
client.trigger_workflow(
|
|
256
|
+
application_id=application_info.id,
|
|
257
|
+
inputs=inputs,
|
|
258
|
+
)
|
|
259
|
+
logger.info(f"Started Execution for Workflow: {application_info.name}")
|
|
260
|
+
executions_page = (
|
|
261
|
+
f"{client.base_url.strip('/')}/deployments/{application_info.id}?tab=executions"
|
|
262
|
+
)
|
|
263
|
+
logger.info(f"You can check the executions at {executions_page}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: truefoundry
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.0rc10
|
|
4
4
|
Summary: Truefoundry CLI
|
|
5
5
|
Author: Abhishek Choudhary
|
|
6
6
|
Author-email: abhishek@truefoundry.com
|
|
@@ -24,7 +24,7 @@ Requires-Dist: flytekit (==1.12.2) ; extra == "workflow"
|
|
|
24
24
|
Requires-Dist: gitignorefile (>=1.1.2,<1.2.0)
|
|
25
25
|
Requires-Dist: importlib-metadata (>=6.0.1,<8.0.0)
|
|
26
26
|
Requires-Dist: importlib-resources (>=5.2.0,<6.0.0)
|
|
27
|
-
Requires-Dist: mlfoundry (==0.11.
|
|
27
|
+
Requires-Dist: mlfoundry (==0.11.3) ; extra == "ml"
|
|
28
28
|
Requires-Dist: openai (>=1.16.2,<2.0.0)
|
|
29
29
|
Requires-Dist: packaging (>=20.0,<25.0)
|
|
30
30
|
Requires-Dist: pydantic (>=1.10.0,<3)
|
|
@@ -25,7 +25,7 @@ truefoundry/autodeploy/utils/diff.py,sha256=Ef8Y-VffDKel_-q-GxRam6gqiv8qTLMcqVg6
|
|
|
25
25
|
truefoundry/autodeploy/utils/pydantic_compat.py,sha256=hEAUy5kLjhPdzw7yGZ2iXGMXbbMVXVlGzIofmyHafXQ,412
|
|
26
26
|
truefoundry/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
truefoundry/cli/__main__.py,sha256=Jap_IddZ9zNyMIyIkCw75xHQCN0WtV2dPZJ_pzdLsVc,916
|
|
28
|
-
truefoundry/deploy/__init__.py,sha256=
|
|
28
|
+
truefoundry/deploy/__init__.py,sha256=ugawKF2G02EmEXX35oZ2tec12d9oWN28Sf6mtGGIERY,2281
|
|
29
29
|
truefoundry/deploy/auto_gen/models.py,sha256=inof7aH6Wk1z15YYtCNJo7sp3Tixv5yaJzB_4fiZux4,78412
|
|
30
30
|
truefoundry/deploy/builder/__init__.py,sha256=a1qR6nicHGcxRaeNTxWRsmDs8zsmXc7j13-I8q0qqVk,4938
|
|
31
31
|
truefoundry/deploy/builder/builders/__init__.py,sha256=tlFLXqyDaKLd4iZbo4Hcu_8gOmgtL6drnXpbmQ6x1P8,636
|
|
@@ -36,7 +36,7 @@ truefoundry/deploy/builder/builders/tfy_python_buildpack/__init__.py,sha256=n7Mw
|
|
|
36
36
|
truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py,sha256=vFmFeK38-t8booJEGREapEjrIL8xnyOQeRSJQq7d3ZQ,6183
|
|
37
37
|
truefoundry/deploy/builder/docker_service.py,sha256=vQS15790njzlFJZ3JW6txYLBdT11ltxqqpf78ZFL_Ng,5208
|
|
38
38
|
truefoundry/deploy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
truefoundry/deploy/cli/cli.py,sha256=
|
|
39
|
+
truefoundry/deploy/cli/cli.py,sha256=l1vRYoovhx40HYZdfsC9JyiYzW9Jx6__7QDzQpN315I,2717
|
|
40
40
|
truefoundry/deploy/cli/commands/__init__.py,sha256=oOstv608ueOJTxR3qlQbZBIdo-FsFe2O0NYNOXi01-s,1276
|
|
41
41
|
truefoundry/deploy/cli/commands/apply_command.py,sha256=Xzky2csXwLARTpQBcPj87imnDu8tIDRN0GnqY8ebEuw,1863
|
|
42
42
|
truefoundry/deploy/cli/commands/build_command.py,sha256=QwKkZ3nVecPMzs-R57YP-_ih9rjTSnhwBWX5tqHVsvU,1255
|
|
@@ -53,7 +53,7 @@ truefoundry/deploy/cli/commands/patch_application_command.py,sha256=Zuswj36o-qni
|
|
|
53
53
|
truefoundry/deploy/cli/commands/patch_command.py,sha256=OQCmxcn1Qd2iZfBUaqs48oUKjHVZ13SoMsWLhksPvks,1682
|
|
54
54
|
truefoundry/deploy/cli/commands/redeploy_command.py,sha256=-wMQLeMcBdJsQBMgTv7rS6hCqH1EJsSKgPrAXU9HjxU,1032
|
|
55
55
|
truefoundry/deploy/cli/commands/terminate_comand.py,sha256=RTNuykw5DBvid44u2nCka_Eu0XSK3Qrzwob9fybHLgQ,1097
|
|
56
|
-
truefoundry/deploy/cli/commands/trigger_command.py,sha256=
|
|
56
|
+
truefoundry/deploy/cli/commands/trigger_command.py,sha256=Js6x7-TEuQQN1fTBoILTJiCt76TdH9qpAnkCnei6vYo,4730
|
|
57
57
|
truefoundry/deploy/cli/config.py,sha256=tf8w4UfVzcC6eYkENvuuCPYt_V3sqVpO1bclORV9tAk,206
|
|
58
58
|
truefoundry/deploy/cli/console.py,sha256=9-dMy4YPisCJQziRKTg8Qa0UJnOGl1soiUnJjsnLDvE,242
|
|
59
59
|
truefoundry/deploy/cli/const.py,sha256=dVHPo1uAiDSSMXwXoT2mR5kNQjExT98QNVRz98Hz_Ts,510
|
|
@@ -83,12 +83,12 @@ truefoundry/deploy/lib/auth/credential_file_manager.py,sha256=DXeXWoVakfZI2Geu8F
|
|
|
83
83
|
truefoundry/deploy/lib/auth/credential_provider.py,sha256=MwTN8170TXi7g9m2Fw4VRReZqk1DzBFG1bMVgd7jYZk,4375
|
|
84
84
|
truefoundry/deploy/lib/auth/servicefoundry_session.py,sha256=2OahwRg-8l3QUwpC2iLA8lHavkeTxKXUP_0AN27HPS8,1859
|
|
85
85
|
truefoundry/deploy/lib/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
|
-
truefoundry/deploy/lib/clients/servicefoundry_client.py,sha256=
|
|
86
|
+
truefoundry/deploy/lib/clients/servicefoundry_client.py,sha256=NASbj67lrQKZwhu7mVu6ngE9A8C76FqqUpfFYQKjVAU,26394
|
|
87
87
|
truefoundry/deploy/lib/clients/shell_client.py,sha256=tMrc0Ha1DmGtUCJrZD8eusOzfe8R_WIe6AAH7nxL0xA,461
|
|
88
88
|
truefoundry/deploy/lib/clients/utils.py,sha256=rK7DrvA71kSTjy23-Bk4LTQjgViBWeHtcV_SlBLZw6M,1282
|
|
89
89
|
truefoundry/deploy/lib/const.py,sha256=Yk_nXeZWzwKs-6hEXDjVDyjwEGh35T5TWaBxyJgP-Zw,1395
|
|
90
90
|
truefoundry/deploy/lib/dao/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
|
-
truefoundry/deploy/lib/dao/application.py,sha256=
|
|
91
|
+
truefoundry/deploy/lib/dao/application.py,sha256=uUTFSQkLUrFCtQQgS2Jm9BpyHyhMkN4GI1yx9oJo4_E,9161
|
|
92
92
|
truefoundry/deploy/lib/dao/apply.py,sha256=sXnQY6RVzLVm1fX2BKuWHAoKlKISirrcByHEhY3x4zo,2570
|
|
93
93
|
truefoundry/deploy/lib/dao/version.py,sha256=AtdW_4O1DPUKdfv2qy6iUJsZ_95vM6z0AqeEy3WDKs8,1130
|
|
94
94
|
truefoundry/deploy/lib/dao/workspace.py,sha256=jm8UWytwVajVcrYyHSTCwWYDYl-RHuk0zAf9Caj4GzQ,2356
|
|
@@ -130,7 +130,7 @@ truefoundry/workflow/map_task.py,sha256=2m3qGXQ90k9LdS45q8dqCCECc3qr8t2m_LMCVd1m
|
|
|
130
130
|
truefoundry/workflow/python_task.py,sha256=SRXRLC4vdBqGjhkwuaY39LEWN6iPCpJAuW17URRdWTY,1128
|
|
131
131
|
truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
|
|
132
132
|
truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
|
|
133
|
-
truefoundry-0.3.
|
|
134
|
-
truefoundry-0.3.
|
|
135
|
-
truefoundry-0.3.
|
|
136
|
-
truefoundry-0.3.
|
|
133
|
+
truefoundry-0.3.0rc10.dist-info/METADATA,sha256=ycIiBcPg1h3rNv8TSK3OHc4PHWDH6DGVP9f0MC5acSo,2694
|
|
134
|
+
truefoundry-0.3.0rc10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
135
|
+
truefoundry-0.3.0rc10.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
|
|
136
|
+
truefoundry-0.3.0rc10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|