pybiolib 1.2.142__py3-none-any.whl → 1.2.152.dev1__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.
@@ -1,10 +1,13 @@
1
1
  import json
2
+ import logging
3
+ import os
2
4
  import re
3
5
  from typing import Optional
4
6
 
5
7
  from biolib import api
6
8
  from biolib._internal.runtime import BioLibRuntimeError, BioLibRuntimeNotRecognizedError, RuntimeJobDataDict
7
9
  from biolib.typing_utils import cast
10
+ from biolib.utils.seq_util import SeqUtil
8
11
 
9
12
 
10
13
  class Runtime:
@@ -54,6 +57,32 @@ class Runtime:
54
57
  path=f"/jobs/{job_data['job_uuid']}/main_result/",
55
58
  )
56
59
 
60
+ @staticmethod
61
+ def set_result_name_prefix(result_prefix: str) -> None:
62
+ Runtime.set_main_result_prefix(result_prefix)
63
+
64
+ @staticmethod
65
+ def set_result_name_prefix_from_fasta(path_to_fasta: str) -> None:
66
+ """
67
+ Set BioLib result name to FASTA file name (excluding file extension) or,
68
+ if detecting a BioLib generated name, use ID of the first sequence in the fasta file
69
+ """
70
+
71
+ def file_path_to_stem(file_path):
72
+ return os.path.splitext(os.path.basename(file_path))[0]
73
+
74
+ # Set job name to first header if FASTA text input (random BioLib file) detected
75
+ if re.match('^input_[A-Za-z0-9]+.*', path_to_fasta):
76
+ first_id = next(SeqUtil.parse_fasta(path_to_fasta)).id
77
+ job_name = first_id.replace(' ', '_')[:60]
78
+
79
+ else:
80
+ job_name = file_path_to_stem(path_to_fasta)
81
+
82
+ logging.debug(f"Setting job name to '{job_name}' from {path_to_fasta}")
83
+
84
+ Runtime.set_result_name_prefix(job_name)
85
+
57
86
  @staticmethod
58
87
  def create_result_note(note: str) -> None:
59
88
  job_id = Runtime.get_job_id()
@@ -359,7 +359,7 @@ class DockerExecutor:
359
359
 
360
360
  if utils.IS_RUNNING_IN_CLOUD:
361
361
  cloud_job = self._options['cloud_job']
362
- create_container_args['mem_limit'] = f'{cloud_job["reserved_memory_in_bytes"]}b'
362
+ create_container_args['mem_limit'] = f'{cloud_job["reserved_memory_in_bytes"] - 500_000_000}b'
363
363
  create_container_args['nano_cpus'] = cloud_job['reserved_cpu_in_nano_shares']
364
364
  create_container_args['pids_limit'] = 10_000
365
365
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.2.142
3
+ Version: 1.2.152.dev1
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -26,7 +26,7 @@ biolib/_internal/types/resource_version.py,sha256=sLxViYXloDDUhTDFgjegiQCj097OM1
26
26
  biolib/_internal/types/typing.py,sha256=D4EKKEe7kDx0K6lJi-H_XLtk-8w6nu2fdqn9bvzI-Xo,288
27
27
  biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
28
28
  biolib/_internal/utils/multinode.py,sha256=zWrQhcVK5u_xdWX2oIM-D_2fINqNPlqF_h71fu4K8LY,8279
29
- biolib/_runtime/runtime.py,sha256=oVgTnDDJv9L4BUP1_sd0oAj4LLyyiPSQdhp7ixWARvw,2923
29
+ biolib/_runtime/runtime.py,sha256=qV706-ZaBihrxSzD9ks62mbllJ3ruCoa6Ecf2zF7naA,3997
30
30
  biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
31
31
  biolib/api/client.py,sha256=FRpdH5aI187b_I_4HUNi680v4iOP65z5f2RcUo8D8MA,3559
32
32
  biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
@@ -77,7 +77,7 @@ biolib/compute_node/job_worker/cache_state.py,sha256=MwjSRzcJJ_4jybqvBL4xdgnDYSI
77
77
  biolib/compute_node/job_worker/cache_types.py,sha256=ajpLy8i09QeQS9dEqTn3T6NVNMY_YsHQkSD5nvIHccQ,818
78
78
  biolib/compute_node/job_worker/docker_image_cache.py,sha256=ansHIkJIq_EMW1nZNlW-RRLVVeKWTbzNICYaOHpKiRE,7460
79
79
  biolib/compute_node/job_worker/executors/__init__.py,sha256=bW6t1qi3PZTlHM4quaTLa8EI4ALTCk83cqcVJfJfJfE,145
80
- biolib/compute_node/job_worker/executors/docker_executor.py,sha256=LcYc4x4-vkmRM1FN1SNj7xRj4qZUNVjQWtgbYMFg3JU,28029
80
+ biolib/compute_node/job_worker/executors/docker_executor.py,sha256=qp8yc1BOkLNpSHbU04H314KVK_c_AjqVsuDrDlMTHbg,28043
81
81
  biolib/compute_node/job_worker/executors/docker_types.py,sha256=VhsU1DKtJjx_BbCkVmiPZPH4ROiL1ygW1Y_s1Kbpa2o,216
82
82
  biolib/compute_node/job_worker/executors/tars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
83
  biolib/compute_node/job_worker/executors/types.py,sha256=yP5gG39hr-DLnw9bOE--VHi-1arDbIYiGuV1rlTbbHI,1466
@@ -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=WJnU9vZdwY8RHXvzATyV80OXzyJ7w9EkG33Tna9Nr6A,5698
121
121
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
122
- pybiolib-1.2.142.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
- pybiolib-1.2.142.dist-info/METADATA,sha256=PvwsBYAZig3L7Re_cMg6Sq3K-25M4aNMeSw6joKGg3Y,1507
124
- pybiolib-1.2.142.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
- pybiolib-1.2.142.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
- pybiolib-1.2.142.dist-info/RECORD,,
122
+ pybiolib-1.2.152.dev1.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
+ pybiolib-1.2.152.dev1.dist-info/METADATA,sha256=Ngmm-Y2RC8rGaqRpWNWT_uJYz59jxm1_SNTUKa8Zn4M,1512
124
+ pybiolib-1.2.152.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
+ pybiolib-1.2.152.dev1.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
+ pybiolib-1.2.152.dev1.dist-info/RECORD,,