truefoundry 0.4.4rc1__py3-none-any.whl → 0.4.4rc3__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.

@@ -50,7 +50,7 @@ def generate_build_script_docker_commands(
50
50
  all_environment_variables = " ".join(environment_variables)
51
51
  run_build_script_command = f"""\
52
52
  COPY {build_script_path} /tmp/user-build-script.sh
53
- RUN {buildkit_secret_mounts} mkdir -p /var/log/ && {all_environment_variables} bash -ex /tmp/user-build-script.sh 2>&1 | tee /var/log/user-build-script-output.log
53
+ RUN {buildkit_secret_mounts} mkdir -p /var/log/ && {all_environment_variables} bash -ex /tmp/user-build-script.sh 2>&1 | tee /var/log/user-build-script-output.log && test ${{PIPESTATUS[0]}} -eq 0
54
54
  """
55
55
  return run_build_script_command
56
56
 
@@ -1,15 +1,16 @@
1
1
  import ast
2
2
  import io
3
+ import json
3
4
  import re
4
- from typing import List
5
+ from typing import Dict, List, Optional
5
6
 
6
7
  from rich.console import Console
7
8
  from rich.pretty import pprint
8
9
 
9
- from truefoundry.deploy import Application
10
+ from truefoundry.deploy import Application, LocalSource
10
11
 
11
12
 
12
- def generate_code(
13
+ def generate_deployment_code(
13
14
  symbols_to_import: List[str],
14
15
  application_type: str,
15
16
  spec_repr: str,
@@ -108,6 +109,13 @@ def convert_deployment_config_to_python(workspace_fqn: str, application_spec: di
108
109
  application = Application.parse_obj(application_spec)
109
110
  application_type = application.__root__.type
110
111
 
112
+ if (
113
+ hasattr(application.__root__, "image")
114
+ and application.__root__.image.type == "build"
115
+ and application.__root__.image.build_source.type == "remote"
116
+ ):
117
+ application.__root__.image.build_source = LocalSource(local_build=False)
118
+
111
119
  spec_repr = get_python_repr(application.__root__)
112
120
  spec_repr = replace_enums_with_values(spec_repr)
113
121
  spec_repr = remove_none_type_fields(spec_repr)
@@ -120,7 +128,7 @@ def convert_deployment_config_to_python(workspace_fqn: str, application_spec: di
120
128
  if "GitSource" in symbols_to_import:
121
129
  symbols_to_import.append("LocalSource")
122
130
 
123
- generated_code = generate_code(
131
+ generated_code = generate_deployment_code(
124
132
  symbols_to_import=symbols_to_import,
125
133
  application_type=application_type,
126
134
  spec_repr=spec_repr,
@@ -131,3 +139,66 @@ def convert_deployment_config_to_python(workspace_fqn: str, application_spec: di
131
139
  generated_code = add_local_source_comment(generated_code)
132
140
 
133
141
  return generated_code
142
+
143
+
144
+ def generate_python_snippet_for_trigger_job(
145
+ application_fqn: str, command: Optional[str], params: Optional[Dict[str, str]]
146
+ ):
147
+ job_run_python_template = """from truefoundry.deploy import trigger_job
148
+
149
+ response = trigger_job(
150
+ application_fqn="{{application_fqn}}",
151
+ # You can pass command or params, but not both
152
+ # command={{command}}
153
+ # params={{params}}
154
+ )
155
+
156
+ print(response.jobRunName)
157
+ """
158
+ output_python_str = job_run_python_template.replace(
159
+ "{{application_fqn}}", application_fqn
160
+ )
161
+
162
+ if command is not None:
163
+ output_python_str = output_python_str.replace("{{command}}", repr(command))
164
+ output_python_str = output_python_str.replace("# command", "command")
165
+ else:
166
+ output_python_str = output_python_str.replace(
167
+ "{{command}}", "<Enter Command Here>"
168
+ )
169
+
170
+ if params is not None:
171
+ output_python_str = output_python_str.replace("{{params}}", repr(params))
172
+ output_python_str = output_python_str.replace("# params", "params")
173
+ else:
174
+ output_python_str = output_python_str.replace(
175
+ "{{params}}", "<Enter Params(key-value pairs) here as python dict>"
176
+ )
177
+
178
+ return output_python_str
179
+
180
+
181
+ def generate_curl_snippet_for_trigger_job(
182
+ control_plane_url: str,
183
+ application_id: str,
184
+ command: Optional[str],
185
+ params: Optional[Dict[str, str]],
186
+ ):
187
+ job_run_curl_request_template = """curl -X 'POST' \\
188
+ '{{control_plane_url}}/api/svc/v1/jobs/trigger' \\
189
+ -H 'accept: */*' \\
190
+ -H 'Authorization: Bearer <Paste your API key here. You can generate it from the Settings Page>' \\
191
+ -H 'Content-Type: application/json' \\
192
+ -d '{
193
+ "applicationId": "{{application_id}}",
194
+ "input": {{input}}
195
+ }'
196
+ """
197
+ output_curl_str = job_run_curl_request_template.replace(
198
+ "{{control_plane_url}}", control_plane_url
199
+ )
200
+ output_curl_str = output_curl_str.replace("{{application_id}}", application_id)
201
+ output_curl_str = output_curl_str.replace(
202
+ "{{input}}", json.dumps({"command": command, "params": params}, indent=2)
203
+ )
204
+ return output_curl_str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: truefoundry
3
- Version: 0.4.4rc1
3
+ Version: 0.4.4rc3
4
4
  Summary: Truefoundry CLI
5
5
  Author: Abhishek Choudhary
6
6
  Author-email: abhishek@truefoundry.com
@@ -41,7 +41,7 @@ truefoundry/deploy/builder/__init__.py,sha256=1qjHMNBE1poRCZW0WrG46dFM1f1IlivD53
41
41
  truefoundry/deploy/builder/builders/__init__.py,sha256=tlFLXqyDaKLd4iZbo4Hcu_8gOmgtL6drnXpbmQ6x1P8,636
42
42
  truefoundry/deploy/builder/builders/dockerfile.py,sha256=AXXTziCkaqIhuM_bwyD1vT1znOwemN1TKgU7eyo-KuM,1522
43
43
  truefoundry/deploy/builder/builders/tfy_notebook_buildpack/__init__.py,sha256=UmMcTY-8MrLY3H5owpn6ax-VePQl4MiMTmHlQ9qEtQw,1742
44
- truefoundry/deploy/builder/builders/tfy_notebook_buildpack/dockerfile_template.py,sha256=IZbXsSj86SxWRZNQXepEnsOL_eYwWaOq5oh-WiyvL2c,2485
44
+ truefoundry/deploy/builder/builders/tfy_notebook_buildpack/dockerfile_template.py,sha256=rQgdvKmAT9HArVW4TAG5yd2QTKRs3S5LJ9RQbc_EkHE,2518
45
45
  truefoundry/deploy/builder/builders/tfy_python_buildpack/__init__.py,sha256=XNJ3MKWqyWIbFNnUQMpB8oVC5Pt5Wsm_bRKbvkXRIG8,1696
46
46
  truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py,sha256=nwTpeIrDOZC8_m_VcbQ5Vp_rEO2ioC8FtzOEo17JY7A,7373
47
47
  truefoundry/deploy/builder/constants.py,sha256=eIukBjD6I4KvEmAPpdbPlPPr76yhS-uNr3RVFkzEdgs,257
@@ -107,7 +107,7 @@ truefoundry/deploy/lib/model/entity.py,sha256=fq8hvdJQgQn4uZqxpKrzmaoJhQG53_EbDo
107
107
  truefoundry/deploy/lib/session.py,sha256=Vg6rCA315T0yS0xG4ayJ84Ia_9ZfibH8utOSwPBMAmw,4953
108
108
  truefoundry/deploy/lib/util.py,sha256=3TapV7yczkheC1MMMfmJDGGzTl2l6e4jCYd_Rr5aoQ8,1330
109
109
  truefoundry/deploy/lib/win32.py,sha256=1RcvPTdlOAJ48rt8rCbE2Ufha2ztRqBAE9dueNXArrY,5009
110
- truefoundry/deploy/python_deploy_codegen.py,sha256=Ok7ufDY2x3aMJv9KpaRqxiS-ZI-kxBWauIUHst-ug7E,4020
110
+ truefoundry/deploy/python_deploy_codegen.py,sha256=Fn2dgn_wcRigaR6Ia4pA7VdhWXaYl5D-o-K8P3953aA,6436
111
111
  truefoundry/deploy/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
112
112
  truefoundry/deploy/v2/lib/__init__.py,sha256=WEiVMZXOVljzEE3tpGJil14liIn_PCDoACJ6b3tZ6sI,188
113
113
  truefoundry/deploy/v2/lib/deploy.py,sha256=HIcY3SzQ5lWl7avuuKi3J0Z-PBES6Sf4hgMK-m6_53U,11990
@@ -340,7 +340,7 @@ truefoundry/workflow/map_task.py,sha256=2m3qGXQ90k9LdS45q8dqCCECc3qr8t2m_LMCVd1m
340
340
  truefoundry/workflow/python_task.py,sha256=SRXRLC4vdBqGjhkwuaY39LEWN6iPCpJAuW17URRdWTY,1128
341
341
  truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
342
342
  truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
343
- truefoundry-0.4.4rc1.dist-info/METADATA,sha256=1fqRs-fBIXRc1DI21OJSATulj9ZPmnUtuNKVZML2y-U,3101
344
- truefoundry-0.4.4rc1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
345
- truefoundry-0.4.4rc1.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
346
- truefoundry-0.4.4rc1.dist-info/RECORD,,
343
+ truefoundry-0.4.4rc3.dist-info/METADATA,sha256=C7iN6mFbrCfs3iLqyPq03a7Lu2QbqmiFwwiAc-G_qhc,3101
344
+ truefoundry-0.4.4rc3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
345
+ truefoundry-0.4.4rc3.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
346
+ truefoundry-0.4.4rc3.dist-info/RECORD,,