pybiolib 1.2.517__py3-none-any.whl → 1.2.520__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/jobs/job.py CHANGED
@@ -230,7 +230,35 @@ class Job:
230
230
  except Exception as error:
231
231
  raise BioLibError(f'Failed to rename job {self._uuid} due to: {error}') from error
232
232
 
233
- def recompute(self, app_uri: Optional[str] = None, machine: Optional[str] = None, blocking: bool = True) -> 'Job':
233
+ def recompute(
234
+ self,
235
+ app_uri: Optional[str] = None,
236
+ machine: Optional[str] = None,
237
+ blocking: bool = True,
238
+ arguments: Optional[List[str]] = None,
239
+ ) -> 'Job':
240
+ """Recompute the job with the same input files but potentially different arguments.
241
+
242
+ Args:
243
+ app_uri (Optional[str], optional): The URI of the app to use for recomputation.
244
+ If None, uses the original app URI. Defaults to None.
245
+ machine (Optional[str], optional): The machine to run the job on.
246
+ If None, uses the original requested machine. Defaults to None.
247
+ blocking (bool, optional): Whether to block until the job completes.
248
+ If True, streams logs until completion. Defaults to True.
249
+ arguments (Optional[List[str]], optional): New arguments to use for the job.
250
+ If None, uses the original arguments. Defaults to None.
251
+
252
+ Returns:
253
+ Job: A new Job instance for the recomputed job.
254
+
255
+ Example::
256
+ >>> job = biolib.get_job("job_id")
257
+ >>> # Recompute with the same arguments
258
+ >>> new_job = job.recompute()
259
+ >>> # Recompute with different arguments
260
+ >>> new_job = job.recompute(arguments=["--new-arg", "value"])
261
+ """
234
262
  app_response = BiolibAppApi.get_by_uri(uri=app_uri or self._job_dict['app_uri'])
235
263
 
236
264
  job_storage_input = RemoteJobStorageEndpoint(
@@ -241,6 +269,16 @@ class Job:
241
269
  http_response = HttpClient.request(url=job_storage_input.get_remote_url())
242
270
  module_input_serialized = http_response.content
243
271
 
272
+ # If arguments are provided, deserialize the module input, update the arguments, and serialize it again
273
+ if arguments is not None:
274
+ module_input = ModuleInput(module_input_serialized)
275
+ module_input_dict = module_input.deserialize()
276
+
277
+ # Create a new ModuleInput with updated arguments
278
+ module_input_serialized = ModuleInput().serialize(
279
+ stdin=module_input_dict['stdin'], arguments=arguments, files=module_input_dict['files']
280
+ )
281
+
244
282
  original_requested_machine = (
245
283
  self._job_dict['requested_machine'] if self._job_dict['requested_machine'] else None
246
284
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pybiolib
3
- Version: 1.2.517
3
+ Version: 1.2.520
4
4
  Summary: BioLib Python Client
5
5
  License: MIT
6
6
  Keywords: biolib
@@ -101,7 +101,7 @@ biolib/compute_node/webserver/worker_thread.py,sha256=7uD9yQPhePYvP2HCJ27EeZ_h6p
101
101
  biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
102
  biolib/experiments/experiment.py,sha256=pBtnOHz0kKoFxlIGf08o8ZCEOze-CljwfOsTdhvCTCk,8646
103
103
  biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
104
- biolib/jobs/job.py,sha256=edKfRiojv6f4sLzz1YfJupwvHL2zuh7L_2v_3a4gSCI,21456
104
+ biolib/jobs/job.py,sha256=vmALUOA9APqz0qTjmlisT6ChZHUwOaTlX-1VLhWJSrA,23176
105
105
  biolib/jobs/job_result.py,sha256=rALHiKYNaC9lHi_JJqBob1RubzNLwG9Z386kwRJjd2M,5885
106
106
  biolib/jobs/types.py,sha256=ezvaoTANsWazK6PmfpYcqezdfjP7MNBEBfqIZGoZhz8,997
107
107
  biolib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -119,8 +119,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
119
119
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
120
120
  biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
121
121
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
122
- pybiolib-1.2.517.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
- pybiolib-1.2.517.dist-info/METADATA,sha256=bpM1eL9PbbUFvNoIdj58Y69eDD9yY8GSOf7G62_EghU,1570
124
- pybiolib-1.2.517.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
125
- pybiolib-1.2.517.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
- pybiolib-1.2.517.dist-info/RECORD,,
122
+ pybiolib-1.2.520.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
+ pybiolib-1.2.520.dist-info/METADATA,sha256=P8QqYdoshoaytFWMOg3byel-wiDde7-iS7YnHgSiYag,1570
124
+ pybiolib-1.2.520.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
125
+ pybiolib-1.2.520.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
+ pybiolib-1.2.520.dist-info/RECORD,,