pybiolib 1.1.1769__py3-none-any.whl → 1.1.1777__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.
@@ -167,7 +167,7 @@ class RemoteHostProxy:
167
167
 
168
168
  if utils.IS_RUNNING_IN_CLOUD:
169
169
  config = CloudUtils.get_webserver_config()
170
- s3_results_bucket_name = config['s3_general_storage_bucket_name'] # pylint: disable=unsubscriptable-object
170
+ s3_results_bucket_name = config['s3_general_storage_bucket_name']
171
171
  s3_results_base_url = f'https://{s3_results_bucket_name}.s3.amazonaws.com'
172
172
  else:
173
173
  if base_url in ('https://biolib.com', 'https://staging-elb.biolib.com'):
@@ -207,6 +207,12 @@ http {{
207
207
  default "";
208
208
  }}
209
209
 
210
+ map $request_method $bearer_token_on_post_and_get {{
211
+ POST "{bearer_token}";
212
+ GET "{bearer_token}";
213
+ default "";
214
+ }}
215
+
210
216
  server {{
211
217
  listen 80;
212
218
  resolver 127.0.0.11 valid=30s;
@@ -283,7 +289,7 @@ http {{
283
289
 
284
290
  location /api/lfs/ {{
285
291
  proxy_pass {base_url}/api/lfs/;
286
- proxy_set_header authorization {'$bearer_token_on_post' if self._can_push_data_record_for_user else '""'};
292
+ proxy_set_header authorization {'$bearer_token_on_post_and_get' if self._can_push_data_record_for_user else '""'};
287
293
  proxy_set_header cookie "";
288
294
  proxy_ssl_server_name on;
289
295
  }}
biolib/lfs/utils.py CHANGED
@@ -13,7 +13,7 @@ from biolib.app import BioLibApp
13
13
  from biolib.biolib_api_client.biolib_account_api import BiolibAccountApi
14
14
  from biolib.biolib_api_client.biolib_large_file_system_api import BiolibLargeFileSystemApi
15
15
  from biolib.biolib_api_client import BiolibApiClient
16
- from biolib.biolib_api_client.lfs_types import LargeFileSystem
16
+ from biolib.biolib_api_client.lfs_types import LargeFileSystem, LargeFileSystemVersion
17
17
  from biolib.biolib_logging import logger
18
18
  from biolib.biolib_errors import BioLibError
19
19
  from biolib.typing_utils import List, Tuple, Iterator, Optional
@@ -111,7 +111,7 @@ def create_large_file_system(lfs_uri: str) -> None:
111
111
  path='/lfs/',
112
112
  data={
113
113
  'account_handle': uri_parsed['account_handle_normalized'],
114
- 'name': uri_parsed['app_name_normalized'],
114
+ 'name': uri_parsed['app_name'],
115
115
  },
116
116
  )
117
117
  lfs: LargeFileSystem = response.json()
@@ -132,8 +132,6 @@ def push_large_file_system(lfs_uri: str, input_dir: str, chunk_size_in_mb: Optio
132
132
  if os.path.realpath(input_dir) == '/':
133
133
  raise BioLibError('Pushing your root directory is not possible')
134
134
 
135
- lfs_resource = BioLibApp(lfs_uri)
136
-
137
135
  original_working_dir = os.getcwd()
138
136
  os.chdir(input_dir)
139
137
  files_to_zip, data_size_in_bytes = get_files_and_size_of_directory(directory=os.getcwd())
@@ -155,9 +153,15 @@ def push_large_file_system(lfs_uri: str, input_dir: str, chunk_size_in_mb: Optio
155
153
  data_size_in_mb = round(data_size_in_bytes / 10 ** 6)
156
154
  print(f'Zipping {len(files_to_zip)} files, in total ~{data_size_in_mb}mb of data')
157
155
 
158
- lfs_resource_version = BiolibLargeFileSystemApi.create_version(resource_uuid=lfs_resource.uuid)
159
- lfs_resource_version_uuid = lfs_resource_version['uuid']
156
+ runtime_job_data = _RuntimeJobData.get()
157
+ if runtime_job_data:
158
+ response = api.client.post(path='/lfs/versions/', data={'resource_uri': lfs_uri})
159
+ lfs_resource_version: LargeFileSystemVersion = response.json()
160
+ else:
161
+ lfs_resource = BioLibApp(lfs_uri)
162
+ lfs_resource_version = BiolibLargeFileSystemApi.create_version(resource_uuid=lfs_resource.uuid)
160
163
 
164
+ lfs_resource_version_uuid = lfs_resource_version['uuid']
161
165
  iterable_zip_stream = get_iterable_zip_stream(files=files_to_zip, chunk_size=chunk_size_in_bytes)
162
166
 
163
167
  multipart_uploader = utils.MultiPartUploader(
biolib/utils/app_uri.py CHANGED
@@ -13,6 +13,7 @@ class SemanticVersion(TypedDict):
13
13
  class AppUriParsed(TypedDict):
14
14
  account_handle_normalized: str
15
15
  app_name_normalized: str
16
+ app_name: str
16
17
  resource_name_prefix: Optional[str]
17
18
  version: Optional[SemanticVersion]
18
19
 
@@ -42,6 +43,7 @@ def parse_app_uri(uri: str) -> AppUriParsed:
42
43
  resource_name_prefix=resource_name_prefix.lower() if resource_name_prefix is not None else 'biolib.com',
43
44
  account_handle_normalized=account_handle_normalized,
44
45
  app_name_normalized=app_name_normalized,
46
+ app_name=app_name if app_name is not None else account_handle_normalized,
45
47
  version=None if not matches.group('version') else SemanticVersion(
46
48
  major=int(matches.group('major')),
47
49
  minor=int(matches.group('minor')),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.1769
3
+ Version: 1.1.1777
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -68,7 +68,7 @@ biolib/compute_node/job_worker/large_file_system.py,sha256=XXqRlVtYhs-Ji9zQGIk5K
68
68
  biolib/compute_node/job_worker/mappings.py,sha256=Z48Kg4nbcOvsT2-9o3RRikBkqflgO4XeaWxTGz-CNvI,2499
69
69
  biolib/compute_node/job_worker/utilization_reporter_thread.py,sha256=7tm5Yk9coqJ9VbEdnO86tSXI0iM0omwIyKENxdxiVXk,8575
70
70
  biolib/compute_node/job_worker/utils.py,sha256=wgxcIA8yAhUPdCwyvuuJ0JmreyWmmUoBO33vWtG60xg,1282
71
- biolib/compute_node/remote_host_proxy.py,sha256=SAp8H-mlNLF5njISF6LTXhSnO9-l5KATiABk-06lS8k,14520
71
+ biolib/compute_node/remote_host_proxy.py,sha256=skBwx6LsMsFfypkxpvL-PqgsjCQbUVTUjlXeKc-VkAw,14648
72
72
  biolib/compute_node/socker_listener_thread.py,sha256=T5_UikA3MB9bD5W_dckYLPTgixh72vKUlgbBvj9dbM0,1601
73
73
  biolib/compute_node/socket_sender_thread.py,sha256=YgamPHeUm2GjMFGx8qk-99WlZhEs-kAb3q_2O6qByig,971
74
74
  biolib/compute_node/utils.py,sha256=M7i_WTyxbFM3Lri9RWZ_8FeQNYrQIWpKGLfp2I55oeY,4677
@@ -87,7 +87,7 @@ biolib/jobs/job_result.py,sha256=8GasUmUXD8SjUYrE2N-HrDx7-AI6TEkFONH8H91t01Q,491
87
87
  biolib/jobs/types.py,sha256=4OAvlhOKANzFMrZDd-mhXpEd8RaKcx8sPneZUoWhJ2U,970
88
88
  biolib/lfs/__init__.py,sha256=wspftSqe_x7xPMZbeW8mcIBuxbHFCiFI3V4TuZU4nZ4,193
89
89
  biolib/lfs/cache.py,sha256=pQS2np21rdJ6I3DpoOutnzPHpLOZgUIS8TMltUJk_k4,2226
90
- biolib/lfs/utils.py,sha256=YUFZlGABMfuOA0BwZ8JGOd-OKNGQVUElLP_4CHe4zyw,10461
90
+ biolib/lfs/utils.py,sha256=tyCVRJs-7haykck_iND7HQ6dZ3pdxs-uDu96YSCLP4Y,10722
91
91
  biolib/runtime/__init__.py,sha256=WyuNnkzj1r-Sx4J-xWzp3US2oo9m5aIuCOYRmjlZ3ug,44
92
92
  biolib/runtime/results.py,sha256=OEtDFb5Auiubh6EClT9L_wMzfRpehIfRwj-8MSVDoz4,522
93
93
  biolib/sdk/__init__.py,sha256=vqqE2Sf3gLySkaJv8VgWtPRkYMi9hOf66y9Ay2waYVE,1339
@@ -98,13 +98,13 @@ biolib/typing_utils.py,sha256=krMhxB3SedVQA3HXIrC7DBXWpHKWN5JNmXGcSrrysOc,263
98
98
  biolib/user/__init__.py,sha256=Db5wtxLfFz3ID9TULSSTo77csw9tO6RtxMRvV5cqKEE,39
99
99
  biolib/user/sign_in.py,sha256=CvHBgoYjg5d5CL9etVopns_g1pImgW8mQH3zAjpe1Ik,2061
100
100
  biolib/utils/__init__.py,sha256=fwjciJyJicvYyZcVTzfDBgD0SKY13DeXqvTeG4qZIy8,5548
101
- biolib/utils/app_uri.py,sha256=hOFsTQfA7QbyQyg9ItGdD8VDWBJw0vYMqzLdSiJXmqQ,1857
101
+ biolib/utils/app_uri.py,sha256=qkI5IsnOfnjKPRBds644FMiajeB074svb7GztoHKb04,1957
102
102
  biolib/utils/cache_state.py,sha256=GaGPxQ1GfrBL6Mzo_HJPpmZCd_CbUDN_l_C5frQ5Sfs,3092
103
103
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
104
104
  biolib/utils/seq_util.py,sha256=3BGUppEaR8asFBxktHCrIW0cMmF23b06PsbDQOoeCDQ,4879
105
105
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
106
- pybiolib-1.1.1769.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
107
- pybiolib-1.1.1769.dist-info/METADATA,sha256=KXli3IcKBh46aLip_NXxYFBYM6frmXZaid1fZATYEnw,1508
108
- pybiolib-1.1.1769.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
109
- pybiolib-1.1.1769.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
110
- pybiolib-1.1.1769.dist-info/RECORD,,
106
+ pybiolib-1.1.1777.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
107
+ pybiolib-1.1.1777.dist-info/METADATA,sha256=f64jPn9vmTg73YM_JZ_n7XxnCEzAgBqP-WUz4u8E0M4,1508
108
+ pybiolib-1.1.1777.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
109
+ pybiolib-1.1.1777.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
110
+ pybiolib-1.1.1777.dist-info/RECORD,,