fractal-server 2.3.0a2__py3-none-any.whl → 2.3.1__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.
- fractal_server/__init__.py +1 -1
- fractal_server/app/routes/api/v1/task_collection.py +2 -2
- fractal_server/app/routes/api/v2/__init__.py +8 -16
- fractal_server/app/routes/api/v2/submit.py +1 -1
- fractal_server/app/routes/api/v2/task_collection.py +72 -17
- fractal_server/app/routes/api/v2/task_collection_custom.py +26 -4
- fractal_server/app/runner/executors/slurm/ssh/executor.py +19 -30
- fractal_server/app/runner/task_files.py +3 -14
- fractal_server/app/runner/v2/__init__.py +5 -8
- fractal_server/app/runner/v2/_slurm_ssh/__init__.py +5 -6
- fractal_server/main.py +7 -5
- fractal_server/ssh/_fabric.py +295 -142
- fractal_server/string_tools.py +39 -0
- fractal_server/tasks/utils.py +0 -4
- fractal_server/tasks/v1/background_operations.py +2 -2
- fractal_server/tasks/v2/background_operations.py +2 -2
- fractal_server/tasks/v2/background_operations_ssh.py +36 -17
- {fractal_server-2.3.0a2.dist-info → fractal_server-2.3.1.dist-info}/METADATA +1 -1
- {fractal_server-2.3.0a2.dist-info → fractal_server-2.3.1.dist-info}/RECORD +22 -22
- fractal_server/app/routes/api/v2/task_collection_ssh.py +0 -125
- {fractal_server-2.3.0a2.dist-info → fractal_server-2.3.1.dist-info}/LICENSE +0 -0
- {fractal_server-2.3.0a2.dist-info → fractal_server-2.3.1.dist-info}/WHEEL +0 -0
- {fractal_server-2.3.0a2.dist-info → fractal_server-2.3.1.dist-info}/entry_points.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
fractal_server/__init__.py,sha256
|
1
|
+
fractal_server/__init__.py,sha256=3adK1MShqavuPoKqyLfQjJfLTaCs4NXxOZDnhC55aBM,22
|
2
2
|
fractal_server/__main__.py,sha256=CocbzZooX1UtGqPi55GcHGNxnrJXFg5tUU5b3wyFCyo,4958
|
3
3
|
fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
|
4
4
|
fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -32,21 +32,20 @@ fractal_server/app/routes/api/v1/dataset.py,sha256=HRE-8vPmVkeXf7WFYkI19mDtbY-iJ
|
|
32
32
|
fractal_server/app/routes/api/v1/job.py,sha256=ctMil9HQLWLlEHFJQ3Z3xV-LWuJHgI6jbf0i3_sd6os,5354
|
33
33
|
fractal_server/app/routes/api/v1/project.py,sha256=MxbJUc9H14ZZ8mmMbX3LXGTVR3sHdD26YSw4TKI7WtU,16108
|
34
34
|
fractal_server/app/routes/api/v1/task.py,sha256=udbKnenzc-Q10elYCVB9JmOPWATraa9tZi0AaByvWo0,6129
|
35
|
-
fractal_server/app/routes/api/v1/task_collection.py,sha256=
|
35
|
+
fractal_server/app/routes/api/v1/task_collection.py,sha256=82XBsJHlPiDPCbpLa-16ojKDpj2LYj9_jFSZt0t58bQ,8911
|
36
36
|
fractal_server/app/routes/api/v1/workflow.py,sha256=7r9IoIevg_rvYCrerMOsIsUabSOQatxdPCfLdkP0dRs,10942
|
37
37
|
fractal_server/app/routes/api/v1/workflowtask.py,sha256=qcHQlzlSFf_k8gtId-mA3tnyzgSR7i1m7pvR4R86blE,5582
|
38
|
-
fractal_server/app/routes/api/v2/__init__.py,sha256=
|
38
|
+
fractal_server/app/routes/api/v2/__init__.py,sha256=JrPWfKIJy9btRCP-zw2nZwLpSdBxEKY5emuCuJbqG0s,1813
|
39
39
|
fractal_server/app/routes/api/v2/_aux_functions.py,sha256=tYJr5EPaA0CVGp-Y4jottFJUVToWvjcSY6PJqN_d--s,14938
|
40
40
|
fractal_server/app/routes/api/v2/dataset.py,sha256=_HjKNP9XsMGoqyubGdF2ZyeW7vXC3VdK_0_TaUxgIF0,8248
|
41
41
|
fractal_server/app/routes/api/v2/images.py,sha256=4r_HblPWyuKSZSJZfn8mbDaLv1ncwZU0gWdKneZcNG4,7894
|
42
42
|
fractal_server/app/routes/api/v2/job.py,sha256=dQN4OVFWpLr0W609zJEHBJE1sQlgKjtHfv8hwpa88g0,5243
|
43
43
|
fractal_server/app/routes/api/v2/project.py,sha256=U4TxD-J4TtQuu1D4BOhL1kTse5fCiNc3BwGH7bnlo38,6592
|
44
44
|
fractal_server/app/routes/api/v2/status.py,sha256=osLexiMOSqmYcEV-41tlrwt9ofyFbtRm5HmPS5BU0t4,6394
|
45
|
-
fractal_server/app/routes/api/v2/submit.py,sha256=
|
45
|
+
fractal_server/app/routes/api/v2/submit.py,sha256=Oqggq3GeBrUsE535tmw-JsRZEWa7jziU34fKdlj4QUE,8734
|
46
46
|
fractal_server/app/routes/api/v2/task.py,sha256=bRTtGgL8BBGbT7csVeRB-a54clgU2xHydi5XpcByDxg,8297
|
47
|
-
fractal_server/app/routes/api/v2/task_collection.py,sha256=
|
48
|
-
fractal_server/app/routes/api/v2/task_collection_custom.py,sha256=
|
49
|
-
fractal_server/app/routes/api/v2/task_collection_ssh.py,sha256=UJDk2ijGRbB314HbscoU5SEkb9C63gV7HME7JiBB7Qw,3809
|
47
|
+
fractal_server/app/routes/api/v2/task_collection.py,sha256=BiZ5s6DwdQbM79s_dPivgoxvNJC3Dzfa4iR3N6A7xfE,12273
|
48
|
+
fractal_server/app/routes/api/v2/task_collection_custom.py,sha256=cvZorN_Xt57Rj-2JATRrdtSw6I_5befB0ua3FWh6hW4,5988
|
50
49
|
fractal_server/app/routes/api/v2/task_legacy.py,sha256=P_VJv9v0yzFUBuS-DQHhMVSOe20ecGJJcFBqiiFciOM,1628
|
51
50
|
fractal_server/app/routes/api/v2/workflow.py,sha256=2GlcYNjpvCdjwC_Kn7y0UP16B3pOLSNXBvIVsVDtDKM,11863
|
52
51
|
fractal_server/app/routes/api/v2/workflowtask.py,sha256=l4eTD5IIun5cOdYzsxh3ajmnOISaSccYA_mVf15Cjtw,8802
|
@@ -68,7 +67,7 @@ fractal_server/app/runner/executors/slurm/remote.py,sha256=wLziIsGdSMiO-jIXM8x77
|
|
68
67
|
fractal_server/app/runner/executors/slurm/ssh/__init__.py,sha256=Cjn1rYvljddi96tAwS-qqGkNfOcfPzjChdaEZEObCcM,65
|
69
68
|
fractal_server/app/runner/executors/slurm/ssh/_executor_wait_thread.py,sha256=jM4G-wiHynZhNERusVGLtDTepJDiYjCDloWZyflaMV0,3482
|
70
69
|
fractal_server/app/runner/executors/slurm/ssh/_slurm_job.py,sha256=rwlqZzoGo4SAb4nSlFjsQJdaCgfM1J6YGcjb8yYxlqc,4506
|
71
|
-
fractal_server/app/runner/executors/slurm/ssh/executor.py,sha256=
|
70
|
+
fractal_server/app/runner/executors/slurm/ssh/executor.py,sha256=FMS0lvb9-pPk8mTkgfLDwljnKq2J_yDqpwth9GZmOOM,55475
|
72
71
|
fractal_server/app/runner/executors/slurm/sudo/__init__.py,sha256=Cjn1rYvljddi96tAwS-qqGkNfOcfPzjChdaEZEObCcM,65
|
73
72
|
fractal_server/app/runner/executors/slurm/sudo/_check_jobs_status.py,sha256=wAgwpVcr6JIslKHOuS0FhRa_6T1KCManyRJqA-fifzw,1909
|
74
73
|
fractal_server/app/runner/executors/slurm/sudo/_executor_wait_thread.py,sha256=z5LlhaiqAb8pHsF1WwdzXN39C5anQmwjo1rSQgtRAYE,4422
|
@@ -78,7 +77,7 @@ fractal_server/app/runner/extract_archive.py,sha256=JDK6wtTFdE7Cf1kGaJajLxNoMmhz
|
|
78
77
|
fractal_server/app/runner/filenames.py,sha256=9lwu3yB4C67yiijYw8XIKaLFn3mJUt6_TCyVFM_aZUQ,206
|
79
78
|
fractal_server/app/runner/set_start_and_last_task_index.py,sha256=-q4zVybAj8ek2XlbENKlfOAJ39hT_zoJoZkqzDqiAMY,1254
|
80
79
|
fractal_server/app/runner/shutdown.py,sha256=I_o2iYKJwzku0L3E85ETjrve3QPECygR5xhhsAo5huM,2910
|
81
|
-
fractal_server/app/runner/task_files.py,sha256=
|
80
|
+
fractal_server/app/runner/task_files.py,sha256=sd_MpJ01C8c9QTO8GzGMidFGdlq_hXX_ARDRhd_YMnI,3762
|
82
81
|
fractal_server/app/runner/v1/__init__.py,sha256=VvJFk4agX2X3fQfDcoNmOB2ouNCaQU7dAqaFmpcdP8I,15063
|
83
82
|
fractal_server/app/runner/v1/_common.py,sha256=rF9IsOo_h_UyeCZ2hkHYPHsdgTjqLlGGig4wyrDS5CQ,21544
|
84
83
|
fractal_server/app/runner/v1/_local/__init__.py,sha256=KlSML4LqF4p1IfhSd8tAkiu3aeDzifeanuNXjATDsYE,6929
|
@@ -90,7 +89,7 @@ fractal_server/app/runner/v1/_slurm/_submit_setup.py,sha256=KO9c694d318adoPQh9UG
|
|
90
89
|
fractal_server/app/runner/v1/_slurm/get_slurm_config.py,sha256=6pQNNx997bLIfLp0guF09t_O0ZYRXnbEGLktSAcKnic,5999
|
91
90
|
fractal_server/app/runner/v1/common.py,sha256=_L-vjLnWato80VdlB_BFN4G8P4jSM07u-5cnl1T3S34,3294
|
92
91
|
fractal_server/app/runner/v1/handle_failed_job.py,sha256=bHzScC_aIlU3q-bQxGW6rfWV4xbZ2tho_sktjsAs1no,4684
|
93
|
-
fractal_server/app/runner/v2/__init__.py,sha256=
|
92
|
+
fractal_server/app/runner/v2/__init__.py,sha256=AFX2TiHfu8vAugvILz484ps4ehZpVHmc3kXGtbhi2zE,16912
|
94
93
|
fractal_server/app/runner/v2/_local/__init__.py,sha256=KTj14K6jH8fXGUi5P7u5_RqEE1zF4aXtgPxCKzw46iw,5971
|
95
94
|
fractal_server/app/runner/v2/_local/_local_config.py,sha256=9oi209Dlp35ANfxb_DISqmMKKc6DPaMsmYVWbZLseME,3630
|
96
95
|
fractal_server/app/runner/v2/_local/_submit_setup.py,sha256=MucNOo8Er0F5ZIwH7CnTeXgnFMc6d3pKPkv563QNVi0,1630
|
@@ -102,7 +101,7 @@ fractal_server/app/runner/v2/_local_experimental/executor.py,sha256=vcBKjireIIyF
|
|
102
101
|
fractal_server/app/runner/v2/_slurm/__init__.py,sha256=q2fwiKqtNpXtfs5wUFQjwJxdYqKPPTbCy1ieBhhi-Bw,4316
|
103
102
|
fractal_server/app/runner/v2/_slurm/_submit_setup.py,sha256=rvhMOK1QkqsxVWUvekT62KbDDlqpw49nq9mzQXSY3H0,2883
|
104
103
|
fractal_server/app/runner/v2/_slurm/get_slurm_config.py,sha256=btGmbZB0fO6bg2WujFxbGEV2iWzaMKbHgV1r2hm_4a0,6748
|
105
|
-
fractal_server/app/runner/v2/_slurm_ssh/__init__.py,sha256=
|
104
|
+
fractal_server/app/runner/v2/_slurm_ssh/__init__.py,sha256=1p6d_ppXBqRNPXPGxM8cmIOffEsfkEPEfvDeT-_90dE,3990
|
106
105
|
fractal_server/app/runner/v2/_slurm_ssh/_submit_setup.py,sha256=rvhMOK1QkqsxVWUvekT62KbDDlqpw49nq9mzQXSY3H0,2883
|
107
106
|
fractal_server/app/runner/v2/_slurm_ssh/get_slurm_config.py,sha256=ZK_yvZhe-nzMAvg54JB6TcaCBplKD9vje92m5-cTxsI,6801
|
108
107
|
fractal_server/app/runner/v2/deduplicate_list.py,sha256=-imwO7OB7ATADEnqVbTElUwoY0YIJCTf_SbWJNN9OZg,639
|
@@ -146,7 +145,7 @@ fractal_server/images/__init__.py,sha256=xO6jTLE4EZKO6cTDdJsBmK9cdeh9hFTaSbSuWgQ
|
|
146
145
|
fractal_server/images/models.py,sha256=9ipU5h4N6ogBChoB-2vHoqtL0TXOHCv6kRR-fER3mkM,4167
|
147
146
|
fractal_server/images/tools.py,sha256=gxeniYy4Z-cp_ToK2LHPJUTVVUUrdpogYdcBUvBuLiY,2209
|
148
147
|
fractal_server/logger.py,sha256=56wfka6fHaa3Rx5qO009nEs_y8gx5wZ2NUNZZ1I-uvc,5130
|
149
|
-
fractal_server/main.py,sha256=
|
148
|
+
fractal_server/main.py,sha256=CTWA_EJBaSO7hty6AdAenFQjbNE4Chr1U-sZ2qsPDmw,5289
|
150
149
|
fractal_server/migrations/README,sha256=4rQvyDfqodGhpJw74VYijRmgFP49ji5chyEemWGHsuw,59
|
151
150
|
fractal_server/migrations/env.py,sha256=Bvg-FJzRJZIH_wqS_ZyZNXANIaathjo22_IY7c3fCjo,2636
|
152
151
|
fractal_server/migrations/script.py.mako,sha256=oMXw9LC3zRbinWWPPDgeZ4z9FJrV2zhRWiYdS5YgNbI,526
|
@@ -168,21 +167,22 @@ fractal_server/migrations/versions/efa89c30e0a4_add_project_timestamp_created.py
|
|
168
167
|
fractal_server/migrations/versions/f384e1c0cf5d_drop_task_default_args_columns.py,sha256=9BwqUS9Gf7UW_KjrzHbtViC880qhD452KAytkHWWZyk,746
|
169
168
|
fractal_server/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
170
169
|
fractal_server/ssh/__init__.py,sha256=sVUmzxf7_DuXG1xoLQ1_00fo5NPhi2LJipSmU5EAkPs,124
|
171
|
-
fractal_server/ssh/_fabric.py,sha256=
|
170
|
+
fractal_server/ssh/_fabric.py,sha256=GsiB3wrNfIkDmXr5A3qjkXhUAaRCyAT4VJRHIAbI1gM,10764
|
171
|
+
fractal_server/string_tools.py,sha256=AwwDb-wtgGQeGdZjZQKgtYCmWbFHGNk_DzaCnYerRAY,1197
|
172
172
|
fractal_server/syringe.py,sha256=3qSMW3YaMKKnLdgnooAINOPxnCOxP7y2jeAQYB21Gdo,2786
|
173
173
|
fractal_server/tasks/__init__.py,sha256=kadmVUoIghl8s190_Tt-8f-WBqMi8u8oU4Pvw39NHE8,23
|
174
|
-
fractal_server/tasks/utils.py,sha256=
|
174
|
+
fractal_server/tasks/utils.py,sha256=wucz57I7G0Vd8hvtmvonlryACx9zIVlqfxG5I87MJ80,1820
|
175
175
|
fractal_server/tasks/v1/_TaskCollectPip.py,sha256=16Gn8lVYHBuwNLBHdcdx0X8s9QXXsbfPwSzcCcM6fRg,3775
|
176
176
|
fractal_server/tasks/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
177
|
-
fractal_server/tasks/v1/background_operations.py,sha256=
|
177
|
+
fractal_server/tasks/v1/background_operations.py,sha256=6EGnZ0kG_N-LUcmUmWNztobmjwMIrO1Al9fMOnCK7Vo,11766
|
178
178
|
fractal_server/tasks/v1/endpoint_operations.py,sha256=YyMU1Y3Xt7D9WOKqaMLuwEoIaAqQP2Klz3I-ypAgOLI,5077
|
179
179
|
fractal_server/tasks/v1/get_collection_data.py,sha256=bi9tuApLgoKZNMIG1kR4GoKI9S6Y040gFfNQapw4ikM,502
|
180
180
|
fractal_server/tasks/v1/utils.py,sha256=J9oKys-82OehBxOon5wWl3CxjVBgYWeVEEyWGVFnreI,1759
|
181
181
|
fractal_server/tasks/v2/_TaskCollectPip.py,sha256=kWQNMNZ8OEddkYhmhsk3E6ArcaD7qe4vsjYYx9vbrUg,4900
|
182
182
|
fractal_server/tasks/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
183
183
|
fractal_server/tasks/v2/_venv_pip.py,sha256=xm4XClWYbhXQRqDxYxM9cP7ZCnx-8b078fuVUL12D2M,6286
|
184
|
-
fractal_server/tasks/v2/background_operations.py,sha256=
|
185
|
-
fractal_server/tasks/v2/background_operations_ssh.py,sha256=
|
184
|
+
fractal_server/tasks/v2/background_operations.py,sha256=CQwQon5RKAXrjsN255Okh5dcT0R45axgqoPW3EB-v_Q,11527
|
185
|
+
fractal_server/tasks/v2/background_operations_ssh.py,sha256=Zjoo3UZQD97INksFkhkTMHYHDltDADs8MbWyAWJtjO8,12926
|
186
186
|
fractal_server/tasks/v2/endpoint_operations.py,sha256=gT38pl5TEH6WNWOtg4Itegt2lTJJI6YRa7fEj9Y4x2s,4226
|
187
187
|
fractal_server/tasks/v2/templates/_1_create_venv.sh,sha256=_Lr1UCWQycqea07YZFICxiwQVz9YZHYS-AaVFjNLUyQ,993
|
188
188
|
fractal_server/tasks/v2/templates/_2_upgrade_pip.sh,sha256=45CPrRxxNBq1ujDA8m1_LWt6QaN1G29mda_LbW2EjN8,626
|
@@ -192,8 +192,8 @@ fractal_server/tasks/v2/templates/_5_pip_show.sh,sha256=3onbKZ0PJkkYronP4_tdMBoA
|
|
192
192
|
fractal_server/tasks/v2/utils.py,sha256=JOyCacb6MNvrwfLNTyLwcz8y79J29YuJeJ2MK5kqXRM,1657
|
193
193
|
fractal_server/urls.py,sha256=5o_qq7PzKKbwq12NHSQZDmDitn5RAOeQ4xufu-2v9Zk,448
|
194
194
|
fractal_server/utils.py,sha256=b7WwFdcFZ8unyT65mloFToYuEDXpQoHRcmRNqrhd_dQ,2115
|
195
|
-
fractal_server-2.3.
|
196
|
-
fractal_server-2.3.
|
197
|
-
fractal_server-2.3.
|
198
|
-
fractal_server-2.3.
|
199
|
-
fractal_server-2.3.
|
195
|
+
fractal_server-2.3.1.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
|
196
|
+
fractal_server-2.3.1.dist-info/METADATA,sha256=K7pVurrpTPJ2W2LKU7EgIo46O-bzD62ZnAWlkH64Wxc,4425
|
197
|
+
fractal_server-2.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
198
|
+
fractal_server-2.3.1.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
|
199
|
+
fractal_server-2.3.1.dist-info/RECORD,,
|
@@ -1,125 +0,0 @@
|
|
1
|
-
from fastapi import APIRouter
|
2
|
-
from fastapi import BackgroundTasks
|
3
|
-
from fastapi import Depends
|
4
|
-
from fastapi import HTTPException
|
5
|
-
from fastapi import Request
|
6
|
-
from fastapi import Response
|
7
|
-
from fastapi import status
|
8
|
-
from pydantic.error_wrappers import ValidationError
|
9
|
-
|
10
|
-
from .....config import get_settings
|
11
|
-
from .....logger import reset_logger_handlers
|
12
|
-
from .....logger import set_logger
|
13
|
-
from .....syringe import Inject
|
14
|
-
from .....tasks.v2._TaskCollectPip import _TaskCollectPip
|
15
|
-
from ....db import AsyncSession
|
16
|
-
from ....db import get_async_db
|
17
|
-
from ....models.v2 import CollectionStateV2
|
18
|
-
from ....schemas.v2 import CollectionStateReadV2
|
19
|
-
from ....schemas.v2 import CollectionStatusV2
|
20
|
-
from ....schemas.v2 import TaskCollectPipV2
|
21
|
-
from ....security import current_active_user
|
22
|
-
from ....security import current_active_verified_user
|
23
|
-
from ....security import User
|
24
|
-
from fractal_server.tasks.v2.background_operations_ssh import (
|
25
|
-
background_collect_pip_ssh,
|
26
|
-
)
|
27
|
-
|
28
|
-
router = APIRouter()
|
29
|
-
|
30
|
-
logger = set_logger(__name__)
|
31
|
-
|
32
|
-
|
33
|
-
@router.post(
|
34
|
-
"/collect/pip/",
|
35
|
-
response_model=CollectionStateReadV2,
|
36
|
-
responses={
|
37
|
-
201: dict(
|
38
|
-
description=(
|
39
|
-
"Task collection successfully started in the background"
|
40
|
-
)
|
41
|
-
),
|
42
|
-
200: dict(
|
43
|
-
description=(
|
44
|
-
"Package already collected. Returning info on already "
|
45
|
-
"available tasks"
|
46
|
-
)
|
47
|
-
),
|
48
|
-
},
|
49
|
-
)
|
50
|
-
async def collect_tasks_pip(
|
51
|
-
task_collect: TaskCollectPipV2,
|
52
|
-
background_tasks: BackgroundTasks,
|
53
|
-
response: Response,
|
54
|
-
request: Request,
|
55
|
-
user: User = Depends(current_active_verified_user),
|
56
|
-
db: AsyncSession = Depends(get_async_db),
|
57
|
-
) -> CollectionStateReadV2:
|
58
|
-
"""
|
59
|
-
Task collection endpoint (SSH version)
|
60
|
-
"""
|
61
|
-
|
62
|
-
# Set default python version
|
63
|
-
if task_collect.python_version is None:
|
64
|
-
settings = Inject(get_settings)
|
65
|
-
task_collect.python_version = (
|
66
|
-
settings.FRACTAL_TASKS_PYTHON_DEFAULT_VERSION
|
67
|
-
)
|
68
|
-
|
69
|
-
# Validate payload as _TaskCollectPip, which has more strict checks than
|
70
|
-
# TaskCollectPip
|
71
|
-
try:
|
72
|
-
task_pkg = _TaskCollectPip(**task_collect.dict(exclude_unset=True))
|
73
|
-
except ValidationError as e:
|
74
|
-
raise HTTPException(
|
75
|
-
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
76
|
-
detail=f"Invalid task-collection object. Original error: {e}",
|
77
|
-
)
|
78
|
-
|
79
|
-
# Note: we don't use TaskCollectStatusV2 here for the JSON column `data`
|
80
|
-
state = CollectionStateV2(
|
81
|
-
data=dict(
|
82
|
-
status=CollectionStatusV2.PENDING, package=task_collect.package
|
83
|
-
)
|
84
|
-
)
|
85
|
-
db.add(state)
|
86
|
-
await db.commit()
|
87
|
-
|
88
|
-
background_tasks.add_task(
|
89
|
-
background_collect_pip_ssh,
|
90
|
-
state.id,
|
91
|
-
task_pkg,
|
92
|
-
request.app.state.connection,
|
93
|
-
)
|
94
|
-
|
95
|
-
response.status_code = status.HTTP_201_CREATED
|
96
|
-
return state
|
97
|
-
|
98
|
-
|
99
|
-
# FIXME SSH: check_collection_status code is almost identical to the
|
100
|
-
# one in task_collection.py
|
101
|
-
@router.get("/collect/{state_id}/", response_model=CollectionStateReadV2)
|
102
|
-
async def check_collection_status(
|
103
|
-
state_id: int,
|
104
|
-
verbose: bool = False,
|
105
|
-
user: User = Depends(current_active_user),
|
106
|
-
db: AsyncSession = Depends(get_async_db),
|
107
|
-
) -> CollectionStateReadV2:
|
108
|
-
"""
|
109
|
-
Check status of background task collection
|
110
|
-
"""
|
111
|
-
logger = set_logger(logger_name="check_collection_status")
|
112
|
-
logger.debug(f"Querying state for state.id={state_id}")
|
113
|
-
state = await db.get(CollectionStateV2, state_id)
|
114
|
-
if not state:
|
115
|
-
await db.close()
|
116
|
-
raise HTTPException(
|
117
|
-
status_code=status.HTTP_404_NOT_FOUND,
|
118
|
-
detail=f"No task collection info with id={state_id}",
|
119
|
-
)
|
120
|
-
|
121
|
-
# FIXME SSH: add logic for when data.state["log"] is empty
|
122
|
-
|
123
|
-
reset_logger_handlers(logger)
|
124
|
-
await db.close()
|
125
|
-
return state
|
File without changes
|
File without changes
|
File without changes
|