pybiolib 1.1.1151__py3-none-any.whl → 1.1.1172__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.
biolib/app/app.py CHANGED
@@ -4,12 +4,14 @@ import io
4
4
  import random
5
5
  import json
6
6
  import string
7
+
8
+ from biolib import utils
7
9
  from biolib.compute_node.job_worker.job_storage import JobStorage
10
+ from biolib.compute_node.job_worker.job_worker import JobWorker
8
11
  from biolib.experiments.experiment import Experiment
9
12
  from biolib.jobs import Job
10
- from biolib.typing_utils import List, Optional, cast
11
- from biolib.app.utils import run_job
12
- from biolib.biolib_api_client import JobState, BiolibApiClient, CreatedJobDict
13
+ from biolib.typing_utils import Optional, cast
14
+ from biolib.biolib_api_client import CreatedJobDict, JobState
13
15
  from biolib.jobs.types import JobDict
14
16
  from biolib.biolib_api_client.app_types import App, AppVersion
15
17
  from biolib.biolib_api_client.biolib_job_api import BiolibJobApi
@@ -51,60 +53,43 @@ class BioLibApp:
51
53
  experiment_id: Optional[str] = None,
52
54
  result_prefix: Optional[str] = None,
53
55
  ) -> Job:
54
-
55
56
  if not experiment_id:
56
57
  experiment = Experiment.get_experiment_in_context()
57
58
  experiment_id = experiment.uuid if experiment else None
58
59
 
59
- if not blocking:
60
- return self._cli_non_blocking(
61
- args,
62
- stdin,
63
- files,
64
- override_command,
65
- machine,
66
- experiment_id,
67
- result_prefix,
68
- )
69
-
70
60
  module_input_serialized = self._get_serialized_module_input(args, stdin, files)
71
61
 
72
- job: CreatedJobDict = BiolibJobApi.create(
73
- app_version_id=self._app_version['public_id'],
74
- override_command=override_command,
75
- experiment_uuid=experiment_id,
76
- machine=machine if machine != 'local' else '',
77
- )
62
+ if machine == 'local':
63
+ if not blocking:
64
+ raise BioLibError('The argument "blocking" cannot be False when running locally')
78
65
 
79
- BiolibJobApi.update_state(job['public_id'], JobState.IN_PROGRESS.value)
66
+ if experiment_id:
67
+ logger.warning('The argument "experiment_id" is ignored when running locally')
80
68
 
81
- try:
82
- module_output = run_job(
83
- job,
84
- module_input_serialized,
85
- force_local=(machine == 'local'),
86
- result_name_prefix=result_prefix,
69
+ if result_prefix:
70
+ logger.warning('The argument "result_prefix" is ignored when running locally')
71
+
72
+ return self._run_locally(module_input_serialized)
73
+
74
+ job = self._start_in_cloud(
75
+ experiment_id=experiment_id,
76
+ machine=machine,
77
+ module_input_serialized=module_input_serialized,
78
+ override_command=override_command,
79
+ result_prefix=result_prefix,
80
+ )
81
+ if blocking:
82
+ # TODO: Deprecate utils.STREAM_STDOUT and always stream logs by simply calling job.stream_logs()
83
+ if utils.IS_RUNNING_IN_NOTEBOOK:
84
+ utils.STREAM_STDOUT = True
85
+
86
+ enable_print = bool(
87
+ utils.STREAM_STDOUT and
88
+ (self._app_version.get('main_output_file') or self._app_version.get('stdout_render_type') == 'text')
87
89
  )
88
- try:
89
- BiolibJobApi.update_state(job_id=job['public_id'], state=JobState.COMPLETED.value)
90
- except Exception as error: # pylint: disable=broad-except
91
- logger.debug(f'Could not update job state to completed:\n{error}')
92
-
93
- # TODO: Create new JobDict that has shared relevant fields
94
- job_dict = cast(JobDict, job)
95
- job_object = Job(job_dict=job_dict)
96
- job_object._set_result_module_output(module_output) # pylint: disable=protected-access
97
- return job_object
98
-
99
- except BioLibError as exception:
100
- logger.error(f'Compute failed with: {exception.message}')
101
- try:
102
- BiolibApiClient.refresh_auth_token()
103
- BiolibJobApi.update_state(job_id=job['public_id'], state=JobState.FAILED.value)
104
- except Exception as error: # pylint: disable=broad-except
105
- logger.debug(f'Could not update job state to failed:\n{error}')
106
-
107
- raise exception
90
+ job._stream_logs(enable_print=enable_print) # pylint: disable=protected-access
91
+
92
+ return job
108
93
 
109
94
  def exec(self, args=None, stdin=None, files=None, machine=''):
110
95
  return self.cli(args, stdin, files, override_command=True, machine=machine)
@@ -146,7 +131,9 @@ Example: "app.cli('--help')"
146
131
  if os.path.isfile(arg) or os.path.isdir(arg):
147
132
  files.append(arg)
148
133
  args[idx] = arg.rstrip('/').split('/')[-1]
149
- elif os.path.isfile(arg.split("=")[-1]) or os.path.isdir(arg.split("=")[-1]): # support --myarg=file.txt
134
+
135
+ # support --myarg=file.txt
136
+ elif os.path.isfile(arg.split("=")[-1]) or os.path.isdir(arg.split("=")[-1]):
150
137
  files.append(arg.split("=")[-1])
151
138
  args[idx] = arg.split("=")[0] + '=' + arg.split("=")[-1].rstrip('/').split('/')[-1]
152
139
  else:
@@ -202,18 +189,15 @@ Example: "app.cli('--help')"
202
189
  )
203
190
  return module_input_serialized
204
191
 
205
- def _cli_non_blocking(
192
+ def _start_in_cloud(
206
193
  self,
207
- args: Optional[List[str]] = None,
208
- stdin: Optional[bytes] = None,
209
- files: Optional[List[str]] = None,
194
+ module_input_serialized: bytes,
210
195
  override_command: bool = False,
211
196
  machine: Optional[str] = None,
212
197
  experiment_id: Optional[str] = None,
213
198
  result_prefix: Optional[str] = None,
214
199
  ) -> Job:
215
- module_input_serialized = self._get_serialized_module_input(args, stdin, files)
216
- if len(module_input_serialized) < 10_000_000:
200
+ if len(module_input_serialized) < 500_000:
217
201
  _job_dict = BiolibJobApi.create_job_with_data(
218
202
  app_version_uuid=self._app_version['public_id'],
219
203
  arguments_override_command=override_command,
@@ -235,11 +219,23 @@ Example: "app.cli('--help')"
235
219
  logger.debug(f"Cloud: Job created with id {cloud_job['public_id']}")
236
220
  return Job(cast(JobDict, job_dict))
237
221
 
222
+ def _run_locally(self, module_input_serialized: bytes) -> Job:
223
+ job_dict = BiolibJobApi.create(app_version_id=self._app_version['public_id'])
224
+ job = Job(job_dict)
225
+ try:
226
+ BiolibJobApi.update_state(job.id, JobState.IN_PROGRESS)
227
+ module_output = JobWorker().run_job_locally(job_dict, module_input_serialized)
228
+ job._set_result_module_output(module_output) # pylint: disable=protected-access
229
+ BiolibJobApi.update_state(job.id, JobState.COMPLETED)
230
+ except BaseException:
231
+ BiolibJobApi.update_state(job.id, JobState.FAILED)
232
+ return job
233
+
238
234
  def run(self, **kwargs) -> Job:
239
235
  args = []
240
236
  for key, value in kwargs.items():
241
237
  if isinstance(value, dict):
242
- value = io.StringIO(json.dumps(value))
238
+ value = io.StringIO(json.dumps(value))
243
239
 
244
240
  if not key.startswith('--'):
245
241
  key = f'--{key}'
@@ -8,9 +8,10 @@ import biolib.api
8
8
 
9
9
  from biolib import utils
10
10
  from biolib.biolib_api_client.auth import BearerAuth
11
- from biolib.biolib_api_client import BiolibApiClient, CloudJob
11
+ from biolib.biolib_api_client import BiolibApiClient, CloudJob, JobState
12
12
  from biolib.biolib_errors import BioLibError, RetryLimitException, StorageDownloadFailed, JobResultPermissionError, \
13
13
  JobResultError, JobResultNotFound
14
+ from biolib.biolib_logging import logger
14
15
  from biolib.utils import BIOLIB_PACKAGE_VERSION
15
16
  from biolib.typing_utils import TypedDict, Optional, Literal, Dict
16
17
 
@@ -75,18 +76,11 @@ class BiolibJobApi:
75
76
  return response.json()
76
77
 
77
78
  @staticmethod
78
- def update_state(job_id, state):
79
- response = requests.patch(
80
- f'{BiolibApiClient.get().base_url}/api/jobs/{job_id}/',
81
- json={'state': state},
82
- auth=BearerAuth(BiolibApiClient.get().access_token)
83
- )
84
-
85
- # TODO: Error handling with response object
86
- if not response.ok:
87
- raise BioLibError(response.content)
88
-
89
- return response.json()
79
+ def update_state(job_uuid: str, state: JobState) -> None:
80
+ try:
81
+ biolib.api.client.patch(path=f'/jobs/{job_uuid}/', data={'state': state.value})
82
+ except BaseException as error:
83
+ logger.error(f'Failed to update job "{job_uuid}" to state "{state.value}" due to {error}')
90
84
 
91
85
  @staticmethod
92
86
  def create_cloud_job(job_id: str, result_name_prefix: Optional[str]) -> CloudJob:
@@ -1,4 +1,2 @@
1
1
  from biolib.compute_node.job_worker.executors.docker_executor import DockerExecutor
2
- from biolib.compute_node.job_worker.executors.remote import RemoteExecutor
3
-
4
2
  from biolib.compute_node.job_worker.executors.types import *
@@ -3,6 +3,7 @@ import json
3
3
  import socket
4
4
  import shlex
5
5
  import sys
6
+ import tempfile
6
7
  import zipfile
7
8
  from time import time
8
9
  from queue import Queue
@@ -36,7 +37,8 @@ from biolib.compute_node.socket_sender_thread import SocketSenderThread
36
37
  from biolib.compute_node.job_worker.mappings import Mappings, path_without_first_folder
37
38
  from biolib.compute_node.job_worker.utils import ComputeProcessException, log_disk_and_memory_usage_info
38
39
  from biolib.compute_node.utils import get_package_type, SystemExceptionCodes, SystemExceptionCodeMap
39
- from biolib.biolib_binary_format import SavedJob, SystemStatusUpdate, ModuleInput, SystemException
40
+ from biolib.biolib_binary_format import SavedJob, SystemStatusUpdate, ModuleInput, SystemException, \
41
+ UnencryptedModuleOutput, InMemoryIndexableBuffer
40
42
 
41
43
  SOCKET_HOST = '127.0.0.1'
42
44
 
@@ -599,18 +601,22 @@ class JobWorker:
599
601
  self._send_status_update(StatusUpdate(progress=94, log_message='Computation finished'))
600
602
  return main_module_output_path
601
603
 
602
- def run_job_locally(self, job: CreatedJobDict, module_input_serialized: bytes, job_temporary_dir: str) -> str:
604
+ def run_job_locally(self, job_dict: CreatedJobDict, module_input_serialized: bytes) -> UnencryptedModuleOutput:
603
605
  try:
604
- self.job_temporary_dir = job_temporary_dir
605
- self._root_job_wrapper = JobWrapper(
606
- access_token=BiolibApiClient.get().access_token or '',
607
- BASE_URL=BiolibApiClient.get().base_url,
608
- cloud_job=None,
609
- compute_node_info=None,
610
- job=job,
611
- job_temporary_dir=job_temporary_dir,
612
- )
613
- self._start_network_and_remote_host_proxies(job)
614
- return self._run_root_job(module_input_serialized)
606
+ with tempfile.TemporaryDirectory() as job_temporary_dir:
607
+ self.job_temporary_dir = job_temporary_dir
608
+ self._root_job_wrapper = JobWrapper(
609
+ access_token=BiolibApiClient.get().access_token or '',
610
+ BASE_URL=BiolibApiClient.get().base_url,
611
+ cloud_job=None,
612
+ compute_node_info=None,
613
+ job=job_dict,
614
+ job_temporary_dir=job_temporary_dir,
615
+ )
616
+ self._start_network_and_remote_host_proxies(job_dict)
617
+ module_output_path = self._run_root_job(module_input_serialized)
618
+ with open(module_output_path, mode='rb') as module_output_file:
619
+ module_output_serialized = module_output_file.read()
620
+ return UnencryptedModuleOutput(InMemoryIndexableBuffer(module_output_serialized))
615
621
  finally:
616
622
  self._cleanup()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.1151
3
+ Version: 1.1.1172
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -4,16 +4,15 @@ biolib/__init__.py,sha256=yoQA2fWt8aToFas3sx6UIoFBW7-dd2yf7Nyi5smQl88,3418
4
4
  biolib/api/__init__.py,sha256=fhsbqVxDYfQ2NMYKkFW-msplAa1YPllfKEkAtLdD9IM,95
5
5
  biolib/api/client.py,sha256=uQhoqFjUS11Fmdm2TB8qTMAAVnvULq1uTWN3cEZKOQc,4954
6
6
  biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
7
- biolib/app/app.py,sha256=IFf8qoAKdhI55WcmBtw4s8GRLtwte6KjM9bWqIEkFI0,9193
7
+ biolib/app/app.py,sha256=2_srxC4zHzANUjwdRWMAPYV4H5yww1oGI-e6pscHZJM,9083
8
8
  biolib/app/search_apps.py,sha256=22rJ_vIxA5GKC6wdDIAjMCe5eOPoPD4BYZuyQ0OddW8,1493
9
- biolib/app/utils.py,sha256=cvIROstlqJJBtYmnQ1DpkD2j0QmpTnoNqQV5G3UXXWQ,1515
10
9
  biolib/biolib_api_client/__init__.py,sha256=E5EMa19wJoblwSdQPYrxc_BtIeRsAuO0L_jQweWw-Yk,182
11
10
  biolib/biolib_api_client/api_client.py,sha256=ny1J8CXY9AO99PRxoI36fAIxNPMIwAMX_69u4vIec1g,5574
12
11
  biolib/biolib_api_client/app_types.py,sha256=mLQ6h8w2Zw1bVCq3ZVEIsCkLi8cNmH5_OoVRNpZp4co,2397
13
12
  biolib/biolib_api_client/auth.py,sha256=mmfeH1ujDRH3_RodqagYtPAfCbFe4SYtJGuFeJzK-UQ,1668
14
13
  biolib/biolib_api_client/biolib_account_api.py,sha256=2Mc6SbmjBSsz8lF2H3iiaZHEm47LyI0B4rjmvzxKHt4,580
15
14
  biolib/biolib_api_client/biolib_app_api.py,sha256=dxQLKgjSvaWsqPEOzt5EXd4gos0SGC1vFkzNbtiU8Lc,2859
16
- biolib/biolib_api_client/biolib_job_api.py,sha256=KxlZpTWLEYMVXXHePnLDiGK3swbKkOz7_tLuk-h2gnU,7142
15
+ biolib/biolib_api_client/biolib_job_api.py,sha256=E9ctexfcg8efKx86LgAv3qQd-Guvdnj78_--PLZ96ls,7092
17
16
  biolib/biolib_api_client/biolib_large_file_system_api.py,sha256=5q4UlRw-OB2bRu7CeB14fy-azz2YeSgem5DbvMSaS44,1777
18
17
  biolib/biolib_api_client/common_types.py,sha256=RH-1KNHqUF-EkTpfPOSTt5Mq1GPdfju_cqXDesscO1I,123
19
18
  biolib/biolib_api_client/job_types.py,sha256=iAVWY7wHnJAPbbFf8_f0LzfYHb2jTaqCH-eaQ-WeXOc,1256
@@ -50,17 +49,15 @@ biolib/compute_node/job_worker/__init__.py,sha256=ipdPWaABKYrltxny15e2kK8PWdEE7V
50
49
  biolib/compute_node/job_worker/cache_state.py,sha256=N2AxvvgfizKx9P_ysM0GDCmueMUlgcveA4xSdz_Z2IQ,4822
51
50
  biolib/compute_node/job_worker/cache_types.py,sha256=4EIF2bohizsuaF61F0ufedBn6zI4SkvclRIFIxhxZuE,891
52
51
  biolib/compute_node/job_worker/docker_image_cache.py,sha256=k5WJe1BR-jA_q5oIqXfVF2Q427X2SPzhse6U5FTlR4w,7562
53
- biolib/compute_node/job_worker/executors/__init__.py,sha256=8gc5uJakp08WA7mt_wY9fpzq1YPJJv_NsNQCk96ht04,221
52
+ biolib/compute_node/job_worker/executors/__init__.py,sha256=bW6t1qi3PZTlHM4quaTLa8EI4ALTCk83cqcVJfJfJfE,145
54
53
  biolib/compute_node/job_worker/executors/docker_executor.py,sha256=iMf1EGfGCizajLTYQbBIcb9Up4VPwWMzjHD6OtbBo8I,24216
55
54
  biolib/compute_node/job_worker/executors/docker_types.py,sha256=VhsU1DKtJjx_BbCkVmiPZPH4ROiL1ygW1Y_s1Kbpa2o,216
56
- biolib/compute_node/job_worker/executors/remote/__init__.py,sha256=Yjav4ARUUb3jscwJHF_XPDL0YQJR483OpDe-8i8Kl4w,91
57
- biolib/compute_node/job_worker/executors/remote/remote_executor.py,sha256=X-Lz9-0jWcYJX5vqht4_5Ru1dEnK2Xt1qMG9vT2rYZs,1595
58
55
  biolib/compute_node/job_worker/executors/tars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
56
  biolib/compute_node/job_worker/executors/types.py,sha256=yP5gG39hr-DLnw9bOE--VHi-1arDbIYiGuV1rlTbbHI,1466
60
57
  biolib/compute_node/job_worker/job_legacy_input_wait_timeout_thread.py,sha256=_cvEiZbOwfkv6fYmfrvdi_FVviIEYr_dSClQcOQaUWM,1198
61
58
  biolib/compute_node/job_worker/job_max_runtime_timer_thread.py,sha256=K_xgz7IhiIjpLlXRk8sqaMyLoApcidJkgu29sJX0gb8,1174
62
59
  biolib/compute_node/job_worker/job_storage.py,sha256=cW0X9qmvpwJNFPLdHSUKrLfl0FEvh1PiikJw7tDz04Q,4846
63
- biolib/compute_node/job_worker/job_worker.py,sha256=PxdPPxUn1TUBWbXE-fWHZHG3A83CsbbMdxWgNlTFYhM,27740
60
+ biolib/compute_node/job_worker/job_worker.py,sha256=I4fSyt5Hk3dz-Or-bAJpAEMdiVwinTX0AuQfawL96dw,28201
64
61
  biolib/compute_node/job_worker/large_file_system.py,sha256=XXqRlVtYhs-Ji9zQGIk5KQPXFO_Q5jJH0nnlw4GkeMY,10461
65
62
  biolib/compute_node/job_worker/mappings.py,sha256=Z48Kg4nbcOvsT2-9o3RRikBkqflgO4XeaWxTGz-CNvI,2499
66
63
  biolib/compute_node/job_worker/utils.py,sha256=wgxcIA8yAhUPdCwyvuuJ0JmreyWmmUoBO33vWtG60xg,1282
@@ -97,8 +94,8 @@ biolib/utils/cache_state.py,sha256=BFrZlV4XZIueIFzAFiPidX4hmwADKY5Y5ZuqlerF5l0,3
97
94
  biolib/utils/multipart_uploader.py,sha256=XFEz-4LRNVFNR6D_FKCecjxosY0bgaR5DGigKAyY5iI,9717
98
95
  biolib/utils/seq_util.py,sha256=CEFtNVBcnmVq_801T_jT4g1O30_iI4P-sRZ2GCU9EqU,1757
99
96
  biolib/utils/zip/remote_zip.py,sha256=NCdUnVbGCv7SfXCI-yVU-is_OnyWmLAnVpIdSvo-W4k,23500
100
- pybiolib-1.1.1151.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
101
- pybiolib-1.1.1151.dist-info/METADATA,sha256=PtOtGUsm46tGnmK3bfv9YwJIirWKQ02HRL8bJj293sg,1574
102
- pybiolib-1.1.1151.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
103
- pybiolib-1.1.1151.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
104
- pybiolib-1.1.1151.dist-info/RECORD,,
97
+ pybiolib-1.1.1172.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
98
+ pybiolib-1.1.1172.dist-info/METADATA,sha256=Buk0oP-lZD0ruRstuKTqD4UFkoqOvUzUAa8ilgzf37Q,1574
99
+ pybiolib-1.1.1172.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
100
+ pybiolib-1.1.1172.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
101
+ pybiolib-1.1.1172.dist-info/RECORD,,
biolib/app/utils.py DELETED
@@ -1,41 +0,0 @@
1
- import tempfile
2
-
3
- from biolib import utils
4
- from biolib.biolib_binary_format import UnencryptedModuleOutput, InMemoryIndexableBuffer
5
- from biolib.biolib_errors import BioLibError
6
- from biolib.biolib_logging import logger
7
- from biolib.compute_node.job_worker.executors import RemoteExecutor, RemoteExecuteOptions
8
- from biolib.compute_node.job_worker.job_worker import JobWorker
9
- from biolib.typing_utils import Optional
10
-
11
-
12
- def run_job(
13
- job,
14
- module_input_serialized: bytes,
15
- force_local: bool = False,
16
- result_name_prefix: Optional[str] = None,
17
- ) -> UnencryptedModuleOutput:
18
- job_id = job['public_id']
19
- logger.info(f'Job "{job_id}" is starting...')
20
-
21
- if not force_local:
22
- return RemoteExecutor.execute_job(
23
- RemoteExecuteOptions(
24
- biolib_base_url=utils.BIOLIB_BASE_URL,
25
- job=job,
26
- result_name_prefix=result_name_prefix,
27
- root_job_id=job_id,
28
- ),
29
- module_input_serialized,
30
- )
31
-
32
- if not job['app_version'].get('modules'):
33
- BioLibError('Unable to run the application locally')
34
-
35
- with tempfile.TemporaryDirectory() as job_temporary_dir:
36
- module_output_path = JobWorker().run_job_locally(job, module_input_serialized, job_temporary_dir)
37
-
38
- with open(module_output_path, mode='rb') as module_output_file:
39
- module_output_serialized = module_output_file.read()
40
-
41
- return UnencryptedModuleOutput(InMemoryIndexableBuffer(module_output_serialized))
@@ -1 +0,0 @@
1
- from biolib.compute_node.job_worker.executors.remote.remote_executor import RemoteExecutor
@@ -1,39 +0,0 @@
1
- from biolib import utils
2
- from biolib.biolib_api_client import BiolibApiClient
3
- from biolib.biolib_api_client.biolib_job_api import BiolibJobApi
4
- from biolib.biolib_binary_format import UnencryptedModuleOutput
5
- from biolib.biolib_logging import logger
6
- from biolib.compute_node.job_worker.executors.types import RemoteExecuteOptions
7
-
8
- from biolib.compute_node.job_worker.job_storage import JobStorage
9
- from biolib.jobs import Job
10
-
11
-
12
- class RemoteExecutor:
13
-
14
- @staticmethod
15
- def execute_job(options: RemoteExecuteOptions, module_input_serialized: bytes) -> UnencryptedModuleOutput:
16
- job_id = options['job']['public_id']
17
- JobStorage.upload_module_input(
18
- job=options['job'],
19
- module_input_serialized=module_input_serialized
20
- )
21
- cloud_job = BiolibJobApi.create_cloud_job(job_id=job_id, result_name_prefix=options['result_name_prefix'])
22
- logger.debug(f"Cloud: Job created with id {cloud_job['public_id']}")
23
-
24
- if utils.IS_RUNNING_IN_NOTEBOOK:
25
- utils.STREAM_STDOUT = True
26
-
27
- app_version = options['job']['app_version']
28
- enable_print = bool(
29
- utils.STREAM_STDOUT and
30
- (app_version.get('main_output_file') or app_version.get('stdout_render_type') == 'text')
31
- )
32
- job = Job.create_from_uuid(
33
- uuid=options['job']['public_id'],
34
- auth_token=options['job']['auth_token']
35
- )
36
- job._stream_logs(enable_print) # pylint: disable=protected-access
37
-
38
- BiolibApiClient.refresh_auth_token()
39
- return JobStorage.get_module_output(job=options['job'])