truefoundry 0.5.0rc7__py3-none-any.whl → 0.5.1rc2__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/common/utils.py +73 -1
- truefoundry/deploy/__init__.py +5 -0
- truefoundry/deploy/cli/cli.py +2 -0
- truefoundry/deploy/cli/commands/__init__.py +1 -0
- truefoundry/deploy/cli/commands/deploy_init_command.py +22 -0
- truefoundry/deploy/lib/dao/application.py +2 -1
- truefoundry/deploy/v2/lib/patched_models.py +8 -0
- truefoundry/ml/__init__.py +14 -12
- truefoundry/ml/autogen/client/__init__.py +5 -0
- truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py +161 -0
- truefoundry/ml/autogen/client/models/__init__.py +5 -0
- truefoundry/ml/autogen/client/models/artifact_version_manifest.py +2 -2
- truefoundry/ml/autogen/client/models/export_deployment_files_request_dto.py +82 -0
- truefoundry/ml/autogen/client/models/infer_method_name.py +34 -0
- truefoundry/ml/autogen/client/models/model_server.py +34 -0
- truefoundry/ml/autogen/client/models/model_version_environment.py +1 -1
- truefoundry/ml/autogen/client/models/model_version_manifest.py +3 -3
- truefoundry/ml/autogen/client/models/sklearn_framework.py +17 -1
- truefoundry/ml/autogen/client/models/transformers_framework.py +2 -2
- truefoundry/ml/autogen/client/models/xg_boost_framework.py +6 -1
- truefoundry/ml/autogen/client_README.md +4 -0
- truefoundry/ml/autogen/entities/artifacts.py +29 -7
- truefoundry/ml/cli/commands/model_init.py +97 -0
- truefoundry/ml/cli/utils.py +34 -0
- truefoundry/ml/log_types/artifacts/model.py +63 -24
- truefoundry/ml/log_types/artifacts/utils.py +37 -1
- truefoundry/ml/mlfoundry_api.py +74 -78
- truefoundry/ml/mlfoundry_run.py +0 -30
- truefoundry/ml/model_framework.py +257 -3
- truefoundry/ml/validation_utils.py +2 -0
- {truefoundry-0.5.0rc7.dist-info → truefoundry-0.5.1rc2.dist-info}/METADATA +1 -5
- {truefoundry-0.5.0rc7.dist-info → truefoundry-0.5.1rc2.dist-info}/RECORD +34 -46
- truefoundry/deploy/function_service/__init__.py +0 -3
- truefoundry/deploy/function_service/__main__.py +0 -27
- truefoundry/deploy/function_service/app.py +0 -92
- truefoundry/deploy/function_service/build.py +0 -45
- truefoundry/deploy/function_service/remote/__init__.py +0 -6
- truefoundry/deploy/function_service/remote/context.py +0 -3
- truefoundry/deploy/function_service/remote/method.py +0 -67
- truefoundry/deploy/function_service/remote/remote.py +0 -144
- truefoundry/deploy/function_service/route.py +0 -137
- truefoundry/deploy/function_service/service.py +0 -113
- truefoundry/deploy/function_service/utils.py +0 -53
- truefoundry/langchain/__init__.py +0 -12
- truefoundry/langchain/deprecated.py +0 -302
- truefoundry/langchain/truefoundry_chat.py +0 -130
- truefoundry/langchain/truefoundry_embeddings.py +0 -171
- truefoundry/langchain/truefoundry_llm.py +0 -106
- truefoundry/langchain/utils.py +0 -44
- truefoundry/ml/log_types/artifacts/model_extras.py +0 -48
- {truefoundry-0.5.0rc7.dist-info → truefoundry-0.5.1rc2.dist-info}/WHEEL +0 -0
- {truefoundry-0.5.0rc7.dist-info → truefoundry-0.5.1rc2.dist-info}/entry_points.txt +0 -0
|
@@ -34,8 +34,8 @@ truefoundry/common/entities.py,sha256=8O-EGPk4PKqnyoFMKUTxISCU19rz0KBnfRDJU695Dh
|
|
|
34
34
|
truefoundry/common/exceptions.py,sha256=ePpiQ_zmWe4e94gOgeMiyP_AZnKwjEBfyXsB5ScGYcI,329
|
|
35
35
|
truefoundry/common/request_utils.py,sha256=5xw4YGUcMf71Ncal3OfFCa-PoWDIvG3hYGCDa4Da4OI,2854
|
|
36
36
|
truefoundry/common/servicefoundry_client.py,sha256=2fxmgCM-ckFHpnm6n_mL-5Z8RWN_q-dYVvFC29bkYSg,3120
|
|
37
|
-
truefoundry/common/utils.py,sha256=
|
|
38
|
-
truefoundry/deploy/__init__.py,sha256=
|
|
37
|
+
truefoundry/common/utils.py,sha256=XgMq06zOu-Fy8ACtbmWlQgAW6jFxKPGHUBirO7N82WA,5725
|
|
38
|
+
truefoundry/deploy/__init__.py,sha256=p14_yIJw2bcaKW3c1DTaoM7UwfHvt2T_MfeFlZIz1g4,2359
|
|
39
39
|
truefoundry/deploy/auto_gen/models.py,sha256=8848BDbq2hO8Y75LsBH3cS0vi8qEOKU5x6oBtVmYorE,82552
|
|
40
40
|
truefoundry/deploy/builder/__init__.py,sha256=1qjHMNBE1poRCZW0WrG46dFM1f1IlivD5352qzsioMU,4953
|
|
41
41
|
truefoundry/deploy/builder/builders/__init__.py,sha256=tlFLXqyDaKLd4iZbo4Hcu_8gOmgtL6drnXpbmQ6x1P8,636
|
|
@@ -48,14 +48,15 @@ truefoundry/deploy/builder/constants.py,sha256=eIukBjD6I4KvEmAPpdbPlPPr76yhS-uNr
|
|
|
48
48
|
truefoundry/deploy/builder/docker_service.py,sha256=OI8efqK0Gnoii8bcHihpA2StwHVzsMREfBk7NvMR4hY,3950
|
|
49
49
|
truefoundry/deploy/builder/utils.py,sha256=9RZnkhoHFTRUt_x3nck0aVz7cLpzA3jiwQH-ZZZrjf8,938
|
|
50
50
|
truefoundry/deploy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
|
-
truefoundry/deploy/cli/cli.py,sha256=
|
|
52
|
-
truefoundry/deploy/cli/commands/__init__.py,sha256
|
|
51
|
+
truefoundry/deploy/cli/cli.py,sha256=BuAW-R98oz1wzPDg00fPgrK1UDoCfy0Tu6pWW9Ud1Ns,2887
|
|
52
|
+
truefoundry/deploy/cli/commands/__init__.py,sha256=-i3ltscehEO0hy-Cf6gPLaiobfv8tZetPKaaCyR9B3M,1364
|
|
53
53
|
truefoundry/deploy/cli/commands/apply_command.py,sha256=FdTeuyOPEoPSU6GP_aQGNOJV0S0rm7PkxrAlXiNvoX8,1864
|
|
54
54
|
truefoundry/deploy/cli/commands/build_command.py,sha256=DQ7NARgkIgV4z0Zdnl3zMDKU_fSkN5-FkjCQypgmWpo,1255
|
|
55
55
|
truefoundry/deploy/cli/commands/build_logs_command.py,sha256=WrPOlFec_wwuzdJmKZ8mjca-oFVvxgfblcqj2LlhWJA,2804
|
|
56
56
|
truefoundry/deploy/cli/commands/create_command.py,sha256=ZjA4EP1jHYuVE1zx0kN-giBr3y0sEiXnu8xMsNyD2Rg,1850
|
|
57
57
|
truefoundry/deploy/cli/commands/delete_command.py,sha256=4tyIameA1pVu9uZZNJPK6rqdV-cJogf51iCCrG-9noI,2390
|
|
58
58
|
truefoundry/deploy/cli/commands/deploy_command.py,sha256=d2Yhgn-zTEIlFUR-IBYpt7-dsec__hsGd1no207u-Q8,4000
|
|
59
|
+
truefoundry/deploy/cli/commands/deploy_init_command.py,sha256=4NnAfd_S_LGwvhRB8z-HEGKoJ2GN1NnKpx9ReDP_HCk,607
|
|
59
60
|
truefoundry/deploy/cli/commands/get_command.py,sha256=w7h5C4bJpmHJ99rgiGg9J_X0xi8aZUeB6Q-SoZUV1tg,5979
|
|
60
61
|
truefoundry/deploy/cli/commands/list_command.py,sha256=cFARY22L5xspBX7TWsx41IF4RiRMok7KBwv7hQRFXNs,4498
|
|
61
62
|
truefoundry/deploy/cli/commands/login_command.py,sha256=WV4Ad8PJ2_yNfCJi1VWW2GNwU6khZ2sWZbKebxJ7oVM,1038
|
|
@@ -74,17 +75,6 @@ truefoundry/deploy/cli/util.py,sha256=bxbNEX3mbhtDpXw3b2GAnbxe0xvCF9N1sCMK6yatz0
|
|
|
74
75
|
truefoundry/deploy/core/__init__.py,sha256=j61bMWj4BkWihdssKMSFhieo7afJDtpc7qO7zk1rDB4,140
|
|
75
76
|
truefoundry/deploy/core/login.py,sha256=N2VrW3nlBzoyoYulkipxwQvCpjBhi3sfsmhxK1ktWhg,236
|
|
76
77
|
truefoundry/deploy/core/logout.py,sha256=TpWLq4_DsxYS5GX2OJQGDhekNOfiOLb-vO5khQueHXw,80
|
|
77
|
-
truefoundry/deploy/function_service/__init__.py,sha256=9aVI0OdXz4pN8an39lMnVjls-NA38mAB38U7G4bM6N4,200
|
|
78
|
-
truefoundry/deploy/function_service/__main__.py,sha256=a4CqaCo_Y2MlbusDme5ybEpc2zNnK10mI-PnV3moHf8,787
|
|
79
|
-
truefoundry/deploy/function_service/app.py,sha256=YqkWav_Nnj0lgBkO2QoR7mMyFw6OzwM-C_VRaccEO3Q,2890
|
|
80
|
-
truefoundry/deploy/function_service/build.py,sha256=XWB4bIIii76Cwq5UBupt5WUNs6InSA3rBQboiDDRDe8,1828
|
|
81
|
-
truefoundry/deploy/function_service/remote/__init__.py,sha256=X1zEW6SSuemydmparLolvQuQSmwXkWUnx516xm3IUaA,199
|
|
82
|
-
truefoundry/deploy/function_service/remote/context.py,sha256=g6HaHM-w-dcfswJFcu6muYhbyFCJID64XnuPN_c0fXo,67
|
|
83
|
-
truefoundry/deploy/function_service/remote/method.py,sha256=DLLgtdQcnTmTiAfeX6pvqM57P1UPbO7kF9B-hPugAGo,1867
|
|
84
|
-
truefoundry/deploy/function_service/remote/remote.py,sha256=iz3Rts03atxlD4fmDOuHeGIt8HlXLF1h8OYD7Lp6XZg,4203
|
|
85
|
-
truefoundry/deploy/function_service/route.py,sha256=Wcn5YacWZXA2XKw98cXbwZLL-AaknLEskybN852LSkk,4513
|
|
86
|
-
truefoundry/deploy/function_service/service.py,sha256=2RnwTSxVa1f12SSqkWD4Ttj6A9hoWchPIscvfXeX3IQ,4169
|
|
87
|
-
truefoundry/deploy/function_service/utils.py,sha256=fSF8g19L-fpbaqf91SEB3HNtaJ93SwKC7txqYePhES0,1332
|
|
88
78
|
truefoundry/deploy/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
79
|
truefoundry/deploy/io/output_callback.py,sha256=V2YwUFec4G4a67lM4r-x_64AqdOVNo_9sTdfQWLlvi0,604
|
|
90
80
|
truefoundry/deploy/io/rich_output_callback.py,sha256=TJLiRD-EnFVwgcepxR7WN0koKqW1X2DevETPhNPi_nU,829
|
|
@@ -95,7 +85,7 @@ truefoundry/deploy/lib/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
|
95
85
|
truefoundry/deploy/lib/clients/servicefoundry_client.py,sha256=tkuPNbo9vDTgXPHD4p3d-t6HigBvKNfML1pTQXBwJfY,26170
|
|
96
86
|
truefoundry/deploy/lib/const.py,sha256=repGJLuoMqtzeq5tCjjkN4bH187FVHVKI30BricOlvc,244
|
|
97
87
|
truefoundry/deploy/lib/dao/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
|
-
truefoundry/deploy/lib/dao/application.py,sha256=
|
|
88
|
+
truefoundry/deploy/lib/dao/application.py,sha256=xUqF34abde71YZo9gkR-WvVJi1C6nBeGBNw4kL5FdIo,9226
|
|
99
89
|
truefoundry/deploy/lib/dao/apply.py,sha256=sXnQY6RVzLVm1fX2BKuWHAoKlKISirrcByHEhY3x4zo,2570
|
|
100
90
|
truefoundry/deploy/lib/dao/version.py,sha256=AtdW_4O1DPUKdfv2qy6iUJsZ_95vM6z0AqeEy3WDKs8,1130
|
|
101
91
|
truefoundry/deploy/lib/dao/workspace.py,sha256=jm8UWytwVajVcrYyHSTCwWYDYl-RHuk0zAf9Caj4GzQ,2356
|
|
@@ -114,20 +104,14 @@ truefoundry/deploy/v2/lib/deploy.py,sha256=HIcY3SzQ5lWl7avuuKi3J0Z-PBES6Sf4hgMK-
|
|
|
114
104
|
truefoundry/deploy/v2/lib/deploy_workflow.py,sha256=hgAhd1EGwFLz319Vs-WNXHDJmbKjdgkGPzDnBD1Up1k,12579
|
|
115
105
|
truefoundry/deploy/v2/lib/deployable_patched_models.py,sha256=MROgMxhn9hDEAKwJSWl3iz12tUVvRKzEtqF2QUT6dAk,3343
|
|
116
106
|
truefoundry/deploy/v2/lib/models.py,sha256=pSolLMTArDuYpeNsmeeS5DWliloN_iCDfZSpRllMHUg,1120
|
|
117
|
-
truefoundry/deploy/v2/lib/patched_models.py,sha256=
|
|
107
|
+
truefoundry/deploy/v2/lib/patched_models.py,sha256=NTU8J_CwdvEuF9zNXwFyN3suOp_196Wrm75DDy5qcXE,14184
|
|
118
108
|
truefoundry/deploy/v2/lib/source.py,sha256=VHKuFREiixUP40D3Mrz-TA70spu1M0RbCzl--qwlFaY,9263
|
|
119
|
-
truefoundry/langchain/__init__.py,sha256=zeYKxKrQhfYXQuBec3wvB_ZqKowDUUjLUKUhbiu9ZFs,558
|
|
120
|
-
truefoundry/langchain/deprecated.py,sha256=8tfLHXwcifGl7DYhMNfzc4zRVCVqEgARg5BsbZp11NE,10835
|
|
121
|
-
truefoundry/langchain/truefoundry_chat.py,sha256=ZA5iyW56fzJeBGxHUpNLFdpy2g9Kw0UHSh0YoNf-xUE,4960
|
|
122
|
-
truefoundry/langchain/truefoundry_embeddings.py,sha256=8nRaZ7W1ao1WF0LHk6nNel1LubA8XtDaffGIlUZYeQM,6104
|
|
123
|
-
truefoundry/langchain/truefoundry_llm.py,sha256=CJXyCgXIMbDsVRuuvEA5PKJsf6aRyVlYuG7zC4qtZXE,3802
|
|
124
|
-
truefoundry/langchain/utils.py,sha256=PGLDe9chZ3BuUjakexOGpIqZRFoHEgu-zJ9yKdpLLmM,1329
|
|
125
109
|
truefoundry/logger.py,sha256=u-YCNjg5HBwE70uQcpjIG64Ghos-K2ulTWaxC03BSj4,714
|
|
126
|
-
truefoundry/ml/__init__.py,sha256=
|
|
110
|
+
truefoundry/ml/__init__.py,sha256=aPrCvFWkb_MGMliT3rBaF4CBcF0AdaymC9DFuK5J7DM,1926
|
|
127
111
|
truefoundry/ml/artifact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
112
|
truefoundry/ml/artifact/truefoundry_artifact_repo.py,sha256=FksxhUpRHb9pgWZmAB16DhXqkAL6UIAPA1S3RJUApQU,46201
|
|
129
113
|
truefoundry/ml/autogen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
130
|
-
truefoundry/ml/autogen/client/__init__.py,sha256=
|
|
114
|
+
truefoundry/ml/autogen/client/__init__.py,sha256=xQKSEKW6Kn-F7GRHaDKjKNjle8JTOFiMs4Liq2kh8Rc,19383
|
|
131
115
|
truefoundry/ml/autogen/client/api/__init__.py,sha256=NyMBxBmIzB1o5LzZZwz9LiydHB3-hPqc_sevsnY6Jrw,746
|
|
132
116
|
truefoundry/ml/autogen/client/api/auth_api.py,sha256=zpWzJhUmW6HHMY_atlUf0B25k77E1kue2hmix5I5Ih0,7017
|
|
133
117
|
truefoundry/ml/autogen/client/api/deprecated_api.py,sha256=mu5x_skNcwz8v1Tr6VP72-tVP7pmBV9muyKy_2NH3F0,38824
|
|
@@ -135,14 +119,14 @@ truefoundry/ml/autogen/client/api/experiments_api.py,sha256=mRKS8qGzcFJUpTWjfQoF
|
|
|
135
119
|
truefoundry/ml/autogen/client/api/generate_code_snippet_api.py,sha256=C8iABP-pYIyIoTlL8PFi3ZBG_6B_dkQf09eErNeoj7A,22316
|
|
136
120
|
truefoundry/ml/autogen/client/api/health_api.py,sha256=IAPhRAo9CLUT5ipVR1fCf-qDx57UR0wg5ekhtUl8lug,11554
|
|
137
121
|
truefoundry/ml/autogen/client/api/metrics_api.py,sha256=q3L38eD-2hu4_9YvcSdnWDYXD2V8il-X9reinOAABek,14908
|
|
138
|
-
truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py,sha256=
|
|
122
|
+
truefoundry/ml/autogen/client/api/mlfoundry_artifacts_api.py,sha256=6AXyTrxQVnBIxELij-4WkdqS-2AJUXZqrxBG_bBuCII,306208
|
|
139
123
|
truefoundry/ml/autogen/client/api/run_artifacts_api.py,sha256=x-vVnY2LEFChZxiiFauswRWwFz6Qqh30PKXjzuTvxmc,8799
|
|
140
124
|
truefoundry/ml/autogen/client/api/runs_api.py,sha256=-aghrZ2VYuZOw_vBtOzWDsnK7Ji29oZQxK2CLRgyo2w,119232
|
|
141
125
|
truefoundry/ml/autogen/client/api_client.py,sha256=M31IycWorn10FYS8WbO_Whaipr0tVu2pVWFCfbS7XCo,29167
|
|
142
126
|
truefoundry/ml/autogen/client/api_response.py,sha256=KRyvecPMXF05PaxILHZ8JHoP4rgKBjKONMgG83aU-rM,844
|
|
143
127
|
truefoundry/ml/autogen/client/configuration.py,sha256=V1oaEnxt-NfpaNmp-EZpf2glovzVhM2coWYt8HBNB4M,15723
|
|
144
128
|
truefoundry/ml/autogen/client/exceptions.py,sha256=XbCbDHhYT3BVejdoGNPgEa4oS56ypkwFdxk1iOc_tFY,5355
|
|
145
|
-
truefoundry/ml/autogen/client/models/__init__.py,sha256=
|
|
129
|
+
truefoundry/ml/autogen/client/models/__init__.py,sha256=_nSy0foDUUFyyE5zSBYKz16d5BvbWzJfCCGvMraUieY,18005
|
|
146
130
|
truefoundry/ml/autogen/client/models/add_custom_metrics_to_model_version_request_dto.py,sha256=_ISDspicTGjBCYYXubKfRYYSSQVyW3AvG-jFh47-Zfc,2163
|
|
147
131
|
truefoundry/ml/autogen/client/models/add_features_to_model_version_request_dto.py,sha256=OT1-98DyWNfAHz_EgD2gMX2XkrGQ4Re945fhoAl8qSE,2099
|
|
148
132
|
truefoundry/ml/autogen/client/models/agent.py,sha256=lUAbs092yo9hZmqzX6atKebDNf1uEwTf5jLvjOdvoeM,3872
|
|
@@ -154,7 +138,7 @@ truefoundry/ml/autogen/client/models/artifact_dto.py,sha256=JWL8_sITJJXbxywcfRj4
|
|
|
154
138
|
truefoundry/ml/autogen/client/models/artifact_response_dto.py,sha256=T_HLjkHnqiO1bnSXiCUOlwDEHGz89mlUNhBq0SJTapo,2226
|
|
155
139
|
truefoundry/ml/autogen/client/models/artifact_type.py,sha256=LBXGYUoesmL5J-0xzCR8jBST3bjb6HY86RmqSGvytRs,828
|
|
156
140
|
truefoundry/ml/autogen/client/models/artifact_version_dto.py,sha256=GXjjKycpsEgJ60V2hAfL4NMxM2gZKLP2qV2yBb9WgdM,6174
|
|
157
|
-
truefoundry/ml/autogen/client/models/artifact_version_manifest.py,sha256=
|
|
141
|
+
truefoundry/ml/autogen/client/models/artifact_version_manifest.py,sha256=3_r-Xsc1OwydVeh9nORAnKegkI73fGgJw4AzKzj0UPQ,3617
|
|
158
142
|
truefoundry/ml/autogen/client/models/artifact_version_response_dto.py,sha256=JmiSYdPYG-ki6LCBeF7NtihdQ2LPiHld8cSPivY2GmQ,2421
|
|
159
143
|
truefoundry/ml/autogen/client/models/artifact_version_serialization_format.py,sha256=2Qfgq1nykn0_mKNEJzOxhQwHm_95WIr9wJcHLeFWXQM,774
|
|
160
144
|
truefoundry/ml/autogen/client/models/artifact_version_status.py,sha256=iIcomqhuaJkZH2rT3e6IjQutM79t9hEshW-RCIMKHEY,780
|
|
@@ -199,6 +183,7 @@ truefoundry/ml/autogen/client/models/experiment_dto.py,sha256=bl4-Hp1EHl8CEKgWq6
|
|
|
199
183
|
truefoundry/ml/autogen/client/models/experiment_id_request_dto.py,sha256=ZMH827n_UTpDI30UnkuOam-4ANBKCDgocIzI8StxFR8,1891
|
|
200
184
|
truefoundry/ml/autogen/client/models/experiment_response_dto.py,sha256=wuflV6_f8PQq061-wU2GzNY4BZi8SG8ARCIbSQN1oT4,2268
|
|
201
185
|
truefoundry/ml/autogen/client/models/experiment_tag_dto.py,sha256=nEpCkeZ9ficIDkjmmLfkJeNNokd-Rhgr-cepPWG6L3M,1902
|
|
186
|
+
truefoundry/ml/autogen/client/models/export_deployment_files_request_dto.py,sha256=6sITpcpFWZ3kC7WOvTKax2QO2OQNHONsPGlmjZQK6ww,2503
|
|
202
187
|
truefoundry/ml/autogen/client/models/external_artifact_source.py,sha256=h94vLz48yQg5l86V17Ve9PuwMnmkrLJxeDlX_tFOJ48,2361
|
|
203
188
|
truefoundry/ml/autogen/client/models/fast_ai_framework.py,sha256=GwVoMbIzYhr4srFXyFb565qq-_Q-7SkUsjT7zlRGz2k,2171
|
|
204
189
|
truefoundry/ml/autogen/client/models/file_info_dto.py,sha256=7oc8venicsFVk8zT9wHNhHnZGtFkFlqimFnS7ozGL9k,2156
|
|
@@ -221,6 +206,7 @@ truefoundry/ml/autogen/client/models/h2_o_framework.py,sha256=5X-0Xbt4tpecV_q6Ww
|
|
|
221
206
|
truefoundry/ml/autogen/client/models/http_validation_error.py,sha256=bU-uUlz_qeFba3iHdBT7cHjLu6WZ-JmImYqgZ-kCvxM,2466
|
|
222
207
|
truefoundry/ml/autogen/client/models/image_content_part.py,sha256=m_LE5XqD_UD0f8jtWt0adRgz_FoLEvgZbCDTSYORnCc,2717
|
|
223
208
|
truefoundry/ml/autogen/client/models/image_url.py,sha256=TN8iEdBUmtKdTFlApUodaC4o6X_Ggd3OSOKVPv7laJE,2170
|
|
209
|
+
truefoundry/ml/autogen/client/models/infer_method_name.py,sha256=01flpfaOwmqXYFZnrSJCVNl8XK4Sen5slxA6zCo4G18,788
|
|
224
210
|
truefoundry/ml/autogen/client/models/internal_metadata.py,sha256=6OizrIzA3QxlEnwNFXCZGOMJuUDSYHctl_30q27uBDI,6232
|
|
225
211
|
truefoundry/ml/autogen/client/models/keras_framework.py,sha256=sBKDT4Dzkvr3Rf7c8YKRbtzaO_KrPNsW8tdWI_n701Q,2150
|
|
226
212
|
truefoundry/ml/autogen/client/models/latest_run_log_dto.py,sha256=wE8T8bANTb9u14Jv7DNyKWekZiUAvrzvTcE_H1cRhn4,2326
|
|
@@ -258,9 +244,10 @@ truefoundry/ml/autogen/client/models/mime_type.py,sha256=A-N5-Mof_IyHWguXmG67k9w
|
|
|
258
244
|
truefoundry/ml/autogen/client/models/model_configuration.py,sha256=XKhwqO8caQ8w9XRCdb_pAl-84cd_PWkEutjLNSby6hQ,3861
|
|
259
245
|
truefoundry/ml/autogen/client/models/model_dto.py,sha256=TUO74MDqe8XCVJBB2O7TiqiRON8qbE7gi8LNA3uWjYA,4685
|
|
260
246
|
truefoundry/ml/autogen/client/models/model_response_dto.py,sha256=osrTxfygkuhxWj6SkRBALrSnFVPH4LSK6qTufTeZuJg,2163
|
|
247
|
+
truefoundry/ml/autogen/client/models/model_server.py,sha256=N5mcWmnX0KzTMtTH8A9h_FmiQcMld3B8CXD_UYeDKaA,700
|
|
261
248
|
truefoundry/ml/autogen/client/models/model_version_dto.py,sha256=9Mh4d8V33gEGYr4sys5lYYDA3bHKajR3oAZLZMAy_io,7094
|
|
262
|
-
truefoundry/ml/autogen/client/models/model_version_environment.py,sha256=
|
|
263
|
-
truefoundry/ml/autogen/client/models/model_version_manifest.py,sha256=
|
|
249
|
+
truefoundry/ml/autogen/client/models/model_version_environment.py,sha256=wTayQjMen24eJCqXQugzoXLANY5NXdVsAvZSh-QIhJA,2827
|
|
250
|
+
truefoundry/ml/autogen/client/models/model_version_manifest.py,sha256=1FZ9VuMp4THs9bOrVM7YWs4eDHfQTcVTQZSN5UbJClI,4906
|
|
264
251
|
truefoundry/ml/autogen/client/models/model_version_response_dto.py,sha256=D6XOCyggxqTkbePuypqYSHYh1PYeDv7R_J32q61sDM0,2320
|
|
265
252
|
truefoundry/ml/autogen/client/models/multi_part_upload_dto.py,sha256=Ckq405vud8RQmMyKCJQJBlW5iXO7Y2mlgo8eVkiMvxg,3738
|
|
266
253
|
truefoundry/ml/autogen/client/models/multi_part_upload_response_dto.py,sha256=VjH0kvl7rMjgDHjYGHnsh7KsZ5-qn-k3ksdGLJ49nIM,2431
|
|
@@ -287,7 +274,7 @@ truefoundry/ml/autogen/client/models/serialization_format.py,sha256=CYq9DR1yipEG
|
|
|
287
274
|
truefoundry/ml/autogen/client/models/set_experiment_tag_request_dto.py,sha256=nrmi_NxLD1fI2gwlpdqFSMnBS11gRkjS4_GQFHgBcXs,2118
|
|
288
275
|
truefoundry/ml/autogen/client/models/set_tag_request_dto.py,sha256=IRgAdMcWBxmjNV6nZJej4pcNfLmZwrelEZ3otwt7eeE,2144
|
|
289
276
|
truefoundry/ml/autogen/client/models/signed_url_dto.py,sha256=9oHoXBj07xTdc04rqOqJO3eOjQWXCyWPhfHg-6qX60w,1897
|
|
290
|
-
truefoundry/ml/autogen/client/models/sklearn_framework.py,sha256=
|
|
277
|
+
truefoundry/ml/autogen/client/models/sklearn_framework.py,sha256=sO3mQRTGKozmkJl4BrukZpNN9bC1WeEEtuxyio4qwn0,3290
|
|
291
278
|
truefoundry/ml/autogen/client/models/source.py,sha256=ZG2-3oIs_M8mZNPjoIRPzhHqlm63vLCVQC9idUxQ0XU,5180
|
|
292
279
|
truefoundry/ml/autogen/client/models/source1.py,sha256=io35b9uVzqSvOHw6RlCXxM30thN-vHm1upaSiN2i0II,5183
|
|
293
280
|
truefoundry/ml/autogen/client/models/spa_cy_framework.py,sha256=Kyrvhdalnl1uQLoPMGMry2PuFGCcQ8AGp4Cx4B9AGXQ,2150
|
|
@@ -300,7 +287,7 @@ truefoundry/ml/autogen/client/models/system_message.py,sha256=2sPSNrDuz5elg_AG00
|
|
|
300
287
|
truefoundry/ml/autogen/client/models/tensor_flow_framework.py,sha256=jsAtqm2rMuiQyR7vVNDTLXDqpIPKsXEOH2WLRGE-POw,2219
|
|
301
288
|
truefoundry/ml/autogen/client/models/text.py,sha256=HAIK-w_TxB1kXGvVNK1d2cweoQi-GJ9d-0QSZl21u68,4862
|
|
302
289
|
truefoundry/ml/autogen/client/models/text_content_part.py,sha256=IgJ5exYltwJdJUBdOxMr3VtjF6x9qbyA_4mTPDZ4QCY,2493
|
|
303
|
-
truefoundry/ml/autogen/client/models/transformers_framework.py,sha256=
|
|
290
|
+
truefoundry/ml/autogen/client/models/transformers_framework.py,sha256=VjzLe6BHZPm7htrtfGZEwt-7mdQt0wfLDSX_Z8hxILY,3496
|
|
304
291
|
truefoundry/ml/autogen/client/models/trigger_job_run_config_request_dto.py,sha256=1HtO6zfW6Ulq8Gm_UL0YqVrse0795vZkMxgCQ0GKD9w,2864
|
|
305
292
|
truefoundry/ml/autogen/client/models/trigger_job_run_config_response_dto.py,sha256=P35xzE8MyS_HtxCcXC9fZORPX2wbf93LbCZCRggkQxw,2144
|
|
306
293
|
truefoundry/ml/autogen/client/models/true_foundry_artifact_source.py,sha256=LihHK1hS5sivJ6EtV1TsYU9ATYgSNDhg10Vhq6ypEG4,2457
|
|
@@ -314,10 +301,10 @@ truefoundry/ml/autogen/client/models/url.py,sha256=zMyOmdVkp1ANnQnc9GrHt42xlVwES
|
|
|
314
301
|
truefoundry/ml/autogen/client/models/user_message.py,sha256=3TEM8qH_zT3dgM197bl44uV7m20IWn6sWeLGfStsN90,2784
|
|
315
302
|
truefoundry/ml/autogen/client/models/validation_error.py,sha256=mFjwoc8g2-Usu1HXZhOQKQ4TGvLy4lwCzk8dHrJ69aA,2597
|
|
316
303
|
truefoundry/ml/autogen/client/models/validation_error_loc_inner.py,sha256=nThJ5Gmy8W2Wok-ZOI4sK7uRe1BAkLS0qzq-XZbq8zs,4915
|
|
317
|
-
truefoundry/ml/autogen/client/models/xg_boost_framework.py,sha256
|
|
304
|
+
truefoundry/ml/autogen/client/models/xg_boost_framework.py,sha256=_YYI6stH0_FRkB7zPfS_85hM_9biwYLr2pLhMBFjARA,2892
|
|
318
305
|
truefoundry/ml/autogen/client/rest.py,sha256=9goba8qHjQuVx5O_yRaTKu7PvBnb7r7swfy3dwuTEgk,14281
|
|
319
|
-
truefoundry/ml/autogen/client_README.md,sha256=
|
|
320
|
-
truefoundry/ml/autogen/entities/artifacts.py,sha256=
|
|
306
|
+
truefoundry/ml/autogen/client_README.md,sha256=9z0MWex6ROr_RjjQ_yOZj9iXWle0pMvNITY1sR_D6TM,36112
|
|
307
|
+
truefoundry/ml/autogen/entities/artifacts.py,sha256=Gz7lmWcQAKNsfLr3Qb5S0-orXuzLNbX66qMEscpyEwY,19483
|
|
321
308
|
truefoundry/ml/autogen/models/__init__.py,sha256=--TGRea9SQBWFfwtcl3ekb1XGfFTdEkQGSG8a2SJ60I,187
|
|
322
309
|
truefoundry/ml/autogen/models/exceptions.py,sha256=q3n7FGBrg_hUy1UyoefhMnhcXUAaqXlLIGHoOVzn_d8,1390
|
|
323
310
|
truefoundry/ml/autogen/models/schema.py,sha256=IhpO9qbygLqEamP3NIt3m90SseJXCOm1ZTqNbNbW-M0,55772
|
|
@@ -327,6 +314,8 @@ truefoundry/ml/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
327
314
|
truefoundry/ml/cli/cli.py,sha256=ckBcjUpqfhgrPE1okqT_G2iouOLt-0KjpLhHp2YdVFU,256
|
|
328
315
|
truefoundry/ml/cli/commands/__init__.py,sha256=diDUiRUX4l6TtNLI4iF-ZblczkELM7FRViJ-8gGNJQY,82
|
|
329
316
|
truefoundry/ml/cli/commands/download.py,sha256=cbz9KijiLKXj4-twlig3xZLTVRNm4fnjwpy0leZr31w,2342
|
|
317
|
+
truefoundry/ml/cli/commands/model_init.py,sha256=LzHYHDOT3MackBIRLi3t18zmrV0E3gCNFLmZSlwwTlk,2661
|
|
318
|
+
truefoundry/ml/cli/utils.py,sha256=j6_mZ4Spn114mz3P4QQ8jx0tmorXIuyQnHXVUSDvZi4,1035
|
|
330
319
|
truefoundry/ml/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
331
320
|
truefoundry/ml/clients/entities.py,sha256=sNP4DnAVdQoMfc06s0r3VTzKHTo7jmxAOuTlQOVmsMs,151
|
|
332
321
|
truefoundry/ml/clients/servicefoundry_client.py,sha256=nmKrWBd7P0VEDGjPHZ8_scX3Xo9tv3wZSWlTIBwGptU,1597
|
|
@@ -342,9 +331,8 @@ truefoundry/ml/log_types/artifacts/artifact.py,sha256=6X4lO23DwM7yTgUOY4RRoYMrf9
|
|
|
342
331
|
truefoundry/ml/log_types/artifacts/constants.py,sha256=qKxQ5mMvJE4j83BvGW3qNTKunxCiBg_EEjTdgbgJtyE,1036
|
|
343
332
|
truefoundry/ml/log_types/artifacts/dataset.py,sha256=a4dxd2EN8p7Ci-cLGGiDOboN3t0395_XhWE1dmTw1Q4,13112
|
|
344
333
|
truefoundry/ml/log_types/artifacts/general_artifact.py,sha256=B4XErLr-m6RmQWtxMTu3wlFRFcqSwPYp6J0OL4Ng6L0,3179
|
|
345
|
-
truefoundry/ml/log_types/artifacts/model.py,sha256=
|
|
346
|
-
truefoundry/ml/log_types/artifacts/
|
|
347
|
-
truefoundry/ml/log_types/artifacts/utils.py,sha256=3FVOYlfcvZiW8vTbMe7Ft1cjNPR2GW7J69M3dyAY-qc,6299
|
|
334
|
+
truefoundry/ml/log_types/artifacts/model.py,sha256=BqZPUt3rKYdlceZ35NNU6a31m0FVEKYbrHQb9tIe8wg,23854
|
|
335
|
+
truefoundry/ml/log_types/artifacts/utils.py,sha256=yhIZYe3Y-J0rG0Wcwql_Qjxe9hlefFbXUfRFqg4E9cM,7502
|
|
348
336
|
truefoundry/ml/log_types/image/__init__.py,sha256=fcOq8yQnNj1rkLcPeIjLXBpdA1WIeiPsXOlAAvMxx7M,76
|
|
349
337
|
truefoundry/ml/log_types/image/constants.py,sha256=wLtGEOA4T5fZHSlOXPuNDLX3lpbCtwlvGKPFk_1fah0,255
|
|
350
338
|
truefoundry/ml/log_types/image/image.py,sha256=qQnAVgErAq4Jn6wXFFpaveOd52zcjUuomUCqNRxO2io,12478
|
|
@@ -354,12 +342,12 @@ truefoundry/ml/log_types/plot.py,sha256=HuYvvRA5r8V0xAIuuqMME2IHb9d3SfGHUiuEkOP3
|
|
|
354
342
|
truefoundry/ml/log_types/pydantic_base.py,sha256=eBlw_AEyAz4iJKDP4zgJOCFWcldwQqpf7FADW1jzIQY,272
|
|
355
343
|
truefoundry/ml/log_types/utils.py,sha256=xjJ21jdPScvFmw3TbVh5NCzbzJwaqiXJyiiT4xxX1EI,335
|
|
356
344
|
truefoundry/ml/logger.py,sha256=VT-BF3BnBYTWVq87O58F0c8uXMu94gYzsiFlGY3_7Ao,458
|
|
357
|
-
truefoundry/ml/mlfoundry_api.py,sha256=
|
|
358
|
-
truefoundry/ml/mlfoundry_run.py,sha256=
|
|
359
|
-
truefoundry/ml/model_framework.py,sha256=
|
|
345
|
+
truefoundry/ml/mlfoundry_api.py,sha256=HbtMh8uFFueJmxcmYTohV3GnziqbSGkOaq3Nv_I-1eU,62458
|
|
346
|
+
truefoundry/ml/mlfoundry_run.py,sha256=C4fhMc9o1m_ubkRsR8R8rk888ktpqWd0pkqZZQ-Pr4k,44691
|
|
347
|
+
truefoundry/ml/model_framework.py,sha256=2JTQ8m5oqy2FaIBqIEgPeDEfwNBfcQHTw-gdcMXF1pA,15033
|
|
360
348
|
truefoundry/ml/run_utils.py,sha256=0W208wSLUrbdfk2pjNcZlkUi9bNxG2JORqoe-5rVqHI,2423
|
|
361
349
|
truefoundry/ml/session.py,sha256=F83GTC5WwGBjnJ69Ct8MqMnlutYc56JCc6YhEY1Wl-A,5394
|
|
362
|
-
truefoundry/ml/validation_utils.py,sha256=
|
|
350
|
+
truefoundry/ml/validation_utils.py,sha256=J5atNhcJLvKj64ralSV9Y5Fv1Rt4SE237ICdP9-7sP4,12149
|
|
363
351
|
truefoundry/pydantic_v1.py,sha256=jSuhGtz0Mbk1qYu8jJ1AcnIDK4oxUsdhALc4spqstmM,345
|
|
364
352
|
truefoundry/version.py,sha256=bqiT4Q-VWrTC6P4qfK43mez-Ppf-smWfrl6DcwV7mrw,137
|
|
365
353
|
truefoundry/workflow/__init__.py,sha256=XY83vqtLAclI82atZXyBtF9ZgLROXaaXO5p60XH5hJA,1493
|
|
@@ -377,7 +365,7 @@ truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=5mBCIc-ON
|
|
|
377
365
|
truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=Hf6Dk6Fu6P7DqsK5ULgraf9DStjgigf-kjaRAMBW-RU,8680
|
|
378
366
|
truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
|
|
379
367
|
truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
|
|
380
|
-
truefoundry-0.5.
|
|
381
|
-
truefoundry-0.5.
|
|
382
|
-
truefoundry-0.5.
|
|
383
|
-
truefoundry-0.5.
|
|
368
|
+
truefoundry-0.5.1rc2.dist-info/METADATA,sha256=vL0TH3dHp17F31KFqk_0vWHF2xefUVPUJHN54CsI7MA,2887
|
|
369
|
+
truefoundry-0.5.1rc2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
370
|
+
truefoundry-0.5.1rc2.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
|
|
371
|
+
truefoundry-0.5.1rc2.dist-info/RECORD,,
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
|
-
import click
|
|
4
|
-
|
|
5
|
-
from truefoundry.deploy.function_service.app import build_and_run_app
|
|
6
|
-
from truefoundry.deploy.function_service.route import RouteGroups
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
####
|
|
10
|
-
# I am keeping the CLI here for now. This will get refactored going forward.
|
|
11
|
-
@click.group()
|
|
12
|
-
def cli():
|
|
13
|
-
pass
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# python -m truefoundry.deploy.function_service run --port 8000 --route-group-json ""
|
|
17
|
-
# I am going to use this as "CMD" in the dockerfile to bring up the service
|
|
18
|
-
@cli.command()
|
|
19
|
-
@click.option("--route-groups-json", required=True, type=str)
|
|
20
|
-
@click.option("--port", required=True, type=int)
|
|
21
|
-
def run(port: int, route_groups_json: str):
|
|
22
|
-
route_groups = RouteGroups.parse_obj(json.loads(route_groups_json))
|
|
23
|
-
build_and_run_app(route_groups=route_groups, port=port)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if __name__ == "__main__":
|
|
27
|
-
cli()
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import importlib
|
|
2
|
-
import os
|
|
3
|
-
from threading import Thread
|
|
4
|
-
|
|
5
|
-
import uvicorn
|
|
6
|
-
from fastapi import FastAPI
|
|
7
|
-
|
|
8
|
-
from truefoundry.deploy.function_service.remote import QUAL_NAME_TO_URL_MAP
|
|
9
|
-
from truefoundry.deploy.function_service.route import (
|
|
10
|
-
ClassRoute,
|
|
11
|
-
FunctionRoute,
|
|
12
|
-
RouteGroups,
|
|
13
|
-
)
|
|
14
|
-
from truefoundry.deploy.function_service.utils import (
|
|
15
|
-
create_pydantic_model_from_function_signature,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def _encapsulate_user_function(function, input_model_name: str):
|
|
20
|
-
model = create_pydantic_model_from_function_signature(
|
|
21
|
-
func=function, model_name=input_model_name
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
def func(x: model):
|
|
25
|
-
return function(**dict(x._iter(to_dict=False)))
|
|
26
|
-
|
|
27
|
-
return func
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _add_function_route(app: FastAPI, function_route: FunctionRoute, port: int):
|
|
31
|
-
module = importlib.import_module(function_route.module)
|
|
32
|
-
function = getattr(module, function_route.function_name)
|
|
33
|
-
|
|
34
|
-
app.add_api_route(
|
|
35
|
-
path=function_route.path,
|
|
36
|
-
endpoint=_encapsulate_user_function(
|
|
37
|
-
function, input_model_name=function_route.qual_name
|
|
38
|
-
),
|
|
39
|
-
methods=[function_route.http_method],
|
|
40
|
-
)
|
|
41
|
-
QUAL_NAME_TO_URL_MAP[function_route.qual_name] = (
|
|
42
|
-
f"http://localhost:{port}{function_route.path}"
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def _add_class_route(app: FastAPI, class_route: ClassRoute, port: int):
|
|
47
|
-
module = importlib.import_module(class_route.module)
|
|
48
|
-
class_factory = getattr(module, class_route.class_name)
|
|
49
|
-
instance = class_factory(**class_route.init_kwargs)
|
|
50
|
-
|
|
51
|
-
for route in class_route.routes:
|
|
52
|
-
function = getattr(instance, route.function_name)
|
|
53
|
-
app.add_api_route(
|
|
54
|
-
path=route.path,
|
|
55
|
-
endpoint=_encapsulate_user_function(function, route.qual_name),
|
|
56
|
-
methods=[route.http_method],
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
QUAL_NAME_TO_URL_MAP[route.qual_name] = f"http://localhost:{port}{route.path}"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def build_app(route_groups: RouteGroups, port: int) -> FastAPI:
|
|
63
|
-
_root_path = os.getenv("TFY_SERVICE_ROOT_PATH")
|
|
64
|
-
app_kwargs = {"root_path": _root_path} if _root_path else {}
|
|
65
|
-
app = FastAPI(docs_url="/", **app_kwargs)
|
|
66
|
-
app.add_api_route(path="/ping", endpoint=lambda: "pong")
|
|
67
|
-
|
|
68
|
-
for route in route_groups.functions:
|
|
69
|
-
_add_function_route(app=app, function_route=route, port=port)
|
|
70
|
-
|
|
71
|
-
for class_route in route_groups.classes.values():
|
|
72
|
-
_add_class_route(app=app, class_route=class_route, port=port)
|
|
73
|
-
|
|
74
|
-
# print(json.dumps(QUAL_NAME_TO_URL_MAP, indent=2))
|
|
75
|
-
return app
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def build_and_run_app(route_groups: RouteGroups, port: int):
|
|
79
|
-
app = build_app(route_groups=route_groups, port=port)
|
|
80
|
-
uvicorn.run(app, port=port, host="0.0.0.0")
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def build_and_run_app_in_background_thread(
|
|
84
|
-
route_groups: RouteGroups, port: int
|
|
85
|
-
) -> Thread:
|
|
86
|
-
thread = Thread(
|
|
87
|
-
target=build_and_run_app,
|
|
88
|
-
kwargs={"route_groups": route_groups, "port": port},
|
|
89
|
-
daemon=True,
|
|
90
|
-
)
|
|
91
|
-
thread.start()
|
|
92
|
-
return thread
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import sys
|
|
3
|
-
from typing import List, Optional
|
|
4
|
-
|
|
5
|
-
from truefoundry.deploy.function_service.route import RouteGroups
|
|
6
|
-
from truefoundry.deploy.v2.lib.patched_models import PythonBuild
|
|
7
|
-
from truefoundry.logger import logger
|
|
8
|
-
from truefoundry.pydantic_v1 import BaseModel, constr
|
|
9
|
-
from truefoundry.version import __version__
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class BuildConfig(BaseModel):
|
|
13
|
-
python_version: constr(regex=r"^\d+(\.\d+){1,2}$") = (
|
|
14
|
-
f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
15
|
-
)
|
|
16
|
-
pip_packages: Optional[List[str]]
|
|
17
|
-
requirements_path: Optional[str] = None
|
|
18
|
-
|
|
19
|
-
def __init__(self, **data):
|
|
20
|
-
pip_packages = data.get("pip_packages", [])
|
|
21
|
-
# locally version == 0.0.0
|
|
22
|
-
# pip_packages.append(f"truefoundry=={__version__}")
|
|
23
|
-
|
|
24
|
-
if __version__ in ("NA", "0.0.0"):
|
|
25
|
-
# TODO (chiragjn): Any change to truefoundry.deploy.function_service.__main__ is untestable!
|
|
26
|
-
# We need to vendor `truefoundry.deploy.function_service` parts in the local source to be able to test.
|
|
27
|
-
tfy_version = "<=1.0.0"
|
|
28
|
-
logger.info("Could not detect truefoundry version. Using %r", tfy_version)
|
|
29
|
-
else:
|
|
30
|
-
tfy_version = f"=={__version__}"
|
|
31
|
-
|
|
32
|
-
pip_packages.append(f"truefoundry{tfy_version}")
|
|
33
|
-
data["pip_packages"] = pip_packages
|
|
34
|
-
super().__init__(**data)
|
|
35
|
-
|
|
36
|
-
def to_tfy_python_build_config(
|
|
37
|
-
self, port: int, route_groups: RouteGroups
|
|
38
|
-
) -> PythonBuild:
|
|
39
|
-
escaped_route_groups_json = json.dumps(route_groups.json())
|
|
40
|
-
return PythonBuild(
|
|
41
|
-
python_version=self.python_version,
|
|
42
|
-
pip_packages=self.pip_packages,
|
|
43
|
-
requirements_path=self.requirements_path,
|
|
44
|
-
command=f"python -m truefoundry.deploy.function_service run --port {port} --route-groups-json {escaped_route_groups_json}",
|
|
45
|
-
)
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import abc
|
|
4
|
-
import json
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
6
|
-
|
|
7
|
-
import requests
|
|
8
|
-
|
|
9
|
-
from truefoundry.deploy.function_service.remote.context import QUAL_NAME_TO_URL_MAP
|
|
10
|
-
|
|
11
|
-
if TYPE_CHECKING:
|
|
12
|
-
from truefoundry.deploy.function_service.remote.remote import Remote
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class Method(abc.ABC):
|
|
16
|
-
def __call__(self, *args, **kwargs):
|
|
17
|
-
if len(args) > 0:
|
|
18
|
-
raise Exception(
|
|
19
|
-
"Positional arguments are not supported now.\n"
|
|
20
|
-
"Please use keyword arguments"
|
|
21
|
-
)
|
|
22
|
-
return self.run(**kwargs)
|
|
23
|
-
|
|
24
|
-
@abc.abstractmethod
|
|
25
|
-
def run(self, **kwargs): ...
|
|
26
|
-
|
|
27
|
-
@abc.abstractmethod
|
|
28
|
-
async def run_async(self, **kwargs): ...
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class LocalMethod(Method):
|
|
32
|
-
def __init__(self, remote_object: Remote, method):
|
|
33
|
-
self._remote_object = remote_object
|
|
34
|
-
self._method_name = method.__name__
|
|
35
|
-
|
|
36
|
-
def run(self, **kwargs):
|
|
37
|
-
return getattr(self._remote_object.instance, self._method_name)(**kwargs)
|
|
38
|
-
|
|
39
|
-
async def run_async(self, **kwargs):
|
|
40
|
-
raise NotImplementedError()
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class RemoteMethod(Method):
|
|
44
|
-
def __init__(self, remote_object: Remote, method):
|
|
45
|
-
self._remote_object = remote_object
|
|
46
|
-
self._method_name = method.__name__
|
|
47
|
-
self._qual_name = self._remote_object.get_qual_name(method)
|
|
48
|
-
|
|
49
|
-
def check(self) -> bool:
|
|
50
|
-
return self._qual_name in QUAL_NAME_TO_URL_MAP
|
|
51
|
-
|
|
52
|
-
def run(self, **kwargs):
|
|
53
|
-
url = QUAL_NAME_TO_URL_MAP.get(self._qual_name)
|
|
54
|
-
r = requests.post(url, json=kwargs)
|
|
55
|
-
assert r.status_code == 200, r.text
|
|
56
|
-
return json.loads(r.text)
|
|
57
|
-
|
|
58
|
-
async def run_async(self, **kwargs):
|
|
59
|
-
raise NotImplementedError()
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def method_factory(*args, **kwargs) -> Method:
|
|
63
|
-
remote_method = RemoteMethod(*args, **kwargs)
|
|
64
|
-
if remote_method.check():
|
|
65
|
-
return remote_method
|
|
66
|
-
|
|
67
|
-
return LocalMethod(*args, **kwargs)
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
import inspect
|
|
3
|
-
from typing import Dict, Optional
|
|
4
|
-
|
|
5
|
-
from truefoundry.deploy.function_service.remote.method import method_factory
|
|
6
|
-
from truefoundry.deploy.function_service.utils import get_qual_name
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Remote(abc.ABC):
|
|
10
|
-
@property
|
|
11
|
-
@abc.abstractmethod
|
|
12
|
-
def instance(self): ...
|
|
13
|
-
|
|
14
|
-
@abc.abstractmethod
|
|
15
|
-
def get_qual_name(self, method) -> str: ...
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class RemoteFunction(Remote):
|
|
19
|
-
def __init__(self, func, **kwargs):
|
|
20
|
-
self._func = func
|
|
21
|
-
self._instance = inspect.getmodule(self._func)
|
|
22
|
-
self.method = method_factory(remote_object=self, method=self._func)
|
|
23
|
-
|
|
24
|
-
def __call__(self, *args, **kwargs):
|
|
25
|
-
if len(args) > 0:
|
|
26
|
-
raise Exception(
|
|
27
|
-
"Positional arguments are not supported now.\n"
|
|
28
|
-
"Please use keyword arguments"
|
|
29
|
-
)
|
|
30
|
-
return self.method.__call__(**kwargs)
|
|
31
|
-
|
|
32
|
-
def run(self, **kwargs):
|
|
33
|
-
return self.method.run(**kwargs)
|
|
34
|
-
|
|
35
|
-
async def run_async(self, **kwargs):
|
|
36
|
-
return await self.method.run_async(**kwargs)
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def instance(self):
|
|
40
|
-
return self._instance
|
|
41
|
-
|
|
42
|
-
def get_qual_name(self, method) -> str:
|
|
43
|
-
return get_qual_name(method)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class RemoteClass(Remote):
|
|
47
|
-
def __init__(
|
|
48
|
-
self,
|
|
49
|
-
class_,
|
|
50
|
-
*,
|
|
51
|
-
init_kwargs: Optional[Dict] = None,
|
|
52
|
-
name: Optional[str] = None,
|
|
53
|
-
**kwargs,
|
|
54
|
-
):
|
|
55
|
-
self._class = class_
|
|
56
|
-
self._name = name or class_.__name__
|
|
57
|
-
self._init_kwargs = init_kwargs or {}
|
|
58
|
-
|
|
59
|
-
self._instance = None
|
|
60
|
-
|
|
61
|
-
###############
|
|
62
|
-
# Maybe this is not the right way to model it.
|
|
63
|
-
# Another approach can be, identify whether the environment is local
|
|
64
|
-
# or our service. If local, then we can just return the instance of
|
|
65
|
-
# the user defined class. Else, we return a class which reflects the
|
|
66
|
-
# methods in the class, but internally doing network call.
|
|
67
|
-
# But I am sticking with this now because not all the concepts of a python
|
|
68
|
-
# class right now, will work in both remote and local. Examples, you cannot
|
|
69
|
-
# access arbitrary attributes, properties etc. I want to keep the behaviour
|
|
70
|
-
# identical for now.
|
|
71
|
-
absent = object()
|
|
72
|
-
methods = inspect.getmembers(class_, predicate=inspect.isfunction)
|
|
73
|
-
for method_name, method in methods:
|
|
74
|
-
if method_name.startswith("_"):
|
|
75
|
-
continue
|
|
76
|
-
existing_attribute = getattr(self, method_name, absent)
|
|
77
|
-
if existing_attribute is not absent:
|
|
78
|
-
raise Exception(
|
|
79
|
-
f"Cannot reflect {method_name!r} of class {class_.__name__!r}.\n"
|
|
80
|
-
f"{method_name!r} is reserved. Use a different method name"
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
setattr(
|
|
84
|
-
self,
|
|
85
|
-
method_name,
|
|
86
|
-
method_factory(remote_object=self, method=method),
|
|
87
|
-
)
|
|
88
|
-
###############
|
|
89
|
-
|
|
90
|
-
def get_qual_name(self, method) -> str:
|
|
91
|
-
return f"{self.name}:{get_qual_name(method)}"
|
|
92
|
-
|
|
93
|
-
@property
|
|
94
|
-
def instance(self):
|
|
95
|
-
if self._instance:
|
|
96
|
-
return self._instance
|
|
97
|
-
instance = self._class(**self._init_kwargs)
|
|
98
|
-
self._instance = instance
|
|
99
|
-
return self._instance
|
|
100
|
-
|
|
101
|
-
@property
|
|
102
|
-
def class_(self):
|
|
103
|
-
return self._class
|
|
104
|
-
|
|
105
|
-
@property
|
|
106
|
-
def name(self) -> str:
|
|
107
|
-
return self._name
|
|
108
|
-
|
|
109
|
-
@property
|
|
110
|
-
def init_kwargs(self) -> Dict:
|
|
111
|
-
return self._init_kwargs
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def remote(func_or_class, **kwargs):
|
|
115
|
-
if inspect.isfunction(func_or_class):
|
|
116
|
-
return RemoteFunction(func_or_class, **kwargs)
|
|
117
|
-
if inspect.isclass(func_or_class):
|
|
118
|
-
return RemoteClass(func_or_class, **kwargs)
|
|
119
|
-
|
|
120
|
-
raise Exception()
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if __name__ == "__main__":
|
|
124
|
-
|
|
125
|
-
def foo(a, b):
|
|
126
|
-
print(a, b)
|
|
127
|
-
|
|
128
|
-
remote(foo)(a=1, b=2)
|
|
129
|
-
|
|
130
|
-
class Foo:
|
|
131
|
-
def __init__(self, a, b):
|
|
132
|
-
self.a = a
|
|
133
|
-
self.b = b
|
|
134
|
-
|
|
135
|
-
def foo(self):
|
|
136
|
-
print(self.a, self.b)
|
|
137
|
-
|
|
138
|
-
foo_instance = remote(Foo, name="foo", init_kwargs={"a": 1, "b": 2})
|
|
139
|
-
foo_instance_2 = remote(Foo, name="foo_2", init_kwargs={"a": 3, "b": 2})
|
|
140
|
-
|
|
141
|
-
foo_instance.foo()
|
|
142
|
-
foo_instance_2.foo()
|
|
143
|
-
foo_instance.foo.run()
|
|
144
|
-
# foo_instance.foo.async_run()
|