geoseeq 0.5.6a12__py3-none-any.whl → 0.5.6a14__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.
geoseeq/cli/main.py CHANGED
@@ -53,7 +53,7 @@ def version():
53
53
  Use of this tool implies acceptance of the GeoSeeq End User License Agreement.
54
54
  Run `geoseeq eula show` to view the EULA.
55
55
  """
56
- click.echo('0.5.6a12') # remember to update setup
56
+ click.echo('0.5.6a14') # remember to update setup
57
57
 
58
58
 
59
59
  @main.group('advanced')
@@ -25,6 +25,7 @@ from geoseeq.cli.shared_params import (
25
25
  project_or_sample_id_arg,
26
26
  handle_project_or_sample_id,
27
27
  no_new_versions_option,
28
+ ignore_errors_option,
28
29
  )
29
30
  from geoseeq.upload_download_manager import GeoSeeqUploadManager
30
31
 
@@ -39,6 +40,7 @@ hidden_option = click.option('--hidden/--no-hidden', default=False, help='Upload
39
40
  @click.option('--cores', default=1, help='Number of uploads to run in parallel', show_default=True)
40
41
  @click.option('--threads-per-upload', default=4, help='Number of threads used to upload each file', show_default=True)
41
42
  @click.option('--num-retries', default=3, help='Number of times to retry a failed upload', show_default=True)
43
+ @ignore_errors_option
42
44
  @yes_option
43
45
  @private_option
44
46
  @link_option
@@ -50,7 +52,7 @@ hidden_option = click.option('--hidden/--no-hidden', default=False, help='Upload
50
52
  show_default=True)
51
53
  @folder_id_arg
52
54
  @click.argument('file_paths', type=click.Path(exists=True), nargs=-1)
53
- def cli_upload_file(state, cores, threads_per_upload, num_retries, yes, private, link_type, recursive, hidden, no_new_versions, geoseeq_file_name, folder_id, file_paths):
55
+ def cli_upload_file(state, cores, threads_per_upload, num_retries, ignore_errors, yes, private, link_type, recursive, hidden, no_new_versions, geoseeq_file_name, folder_id, file_paths):
54
56
  """Upload files to GeoSeeq.
55
57
 
56
58
  This command uploads files to either a sample or project on GeoSeeq. It can be used to upload
@@ -118,6 +120,8 @@ def cli_upload_file(state, cores, threads_per_upload, num_retries, yes, private,
118
120
  no_new_versions=no_new_versions,
119
121
  use_cache=state.use_cache,
120
122
  num_retries=num_retries,
123
+ ignore_errors=ignore_errors,
124
+ session=knex.new_session(),
121
125
  )
122
126
  for geoseeq_file_name, file_path in name_pairs:
123
127
  if isfile(file_path):
geoseeq/knex.py CHANGED
@@ -96,6 +96,9 @@ class Knex:
96
96
  sess.auth = self.auth
97
97
  sess.verify = self._verify
98
98
  return sess
99
+
100
+ def new_session(self):
101
+ return self._new_session()
99
102
 
100
103
  def _set_verify(self):
101
104
  try:
@@ -4,7 +4,7 @@ import json
4
4
  import os
5
5
  from os.path import basename, getsize, join, dirname, isfile, getctime
6
6
  from pathlib import Path
7
-
7
+ from random import random
8
8
  import requests
9
9
 
10
10
  from geoseeq.knex import GeoseeqGeneralError
@@ -184,14 +184,16 @@ class ResultFileUpload:
184
184
  logger.debug(f"Upload for part {num + 1} succeeded.")
185
185
  break
186
186
  except (requests.exceptions.HTTPError, requests.exceptions.SSLError, requests.exceptions.ConnectionError) as e:
187
+ attempts += 1
187
188
  logger.debug(
188
- f"Upload for part {num + 1} failed. Attempt {attempts + 1} of {max_retries}."
189
+ f"Upload for part {num + 1} failed. Attempt {attempts} of {max_retries}. Error: {e}"
189
190
  )
190
- attempts += 1
191
191
  if attempts >= max_retries:
192
192
  raise e
193
193
 
194
194
  retry_time = min(8 ** attempts, 120) # exponential backoff, max 120s
195
+ retry_time *= 0.8 + (random() * 0.4) # randomize to avoid thundering herd
196
+ logger.debug(f"Retrying upload for part {num + 1} in {retry_time} seconds.")
195
197
  time.sleep(retry_time)
196
198
 
197
199
  etag = http_response.headers["ETag"].replace('"', "")
@@ -22,19 +22,25 @@ def _upload_one_file(args):
22
22
  (result_file, filepath, session, progress_tracker,
23
23
  link_type, overwrite, log_level, parallel_uploads,
24
24
  use_cache, no_new_versions, threads_per_upload,
25
- num_retries) = args
25
+ num_retries, ignore_errors) = args
26
26
  if parallel_uploads:
27
27
  _make_in_process_logger(log_level)
28
- if link_type == 'upload':
29
- # TODO: check checksums to see if the file is the same
30
- result_file.upload_file(
31
- filepath,
32
- session=session, overwrite=overwrite, progress_tracker=progress_tracker,
33
- threads=threads_per_upload, use_cache=use_cache,
34
- no_new_versions=no_new_versions, max_retries=num_retries,
35
- )
36
- else:
37
- result_file.link_file(link_type, filepath)
28
+ try:
29
+ if link_type == 'upload':
30
+ # TODO: check checksums to see if the file is the same
31
+ result_file.upload_file(
32
+ filepath,
33
+ session=session, overwrite=overwrite, progress_tracker=progress_tracker,
34
+ threads=threads_per_upload, use_cache=use_cache,
35
+ no_new_versions=no_new_versions, max_retries=num_retries,
36
+ )
37
+ else:
38
+ result_file.link_file(link_type, filepath)
39
+ except Exception as e:
40
+ if ignore_errors:
41
+ logger.error(f"Error uploading {filepath}: {e}")
42
+ else:
43
+ raise e
38
44
  return result_file
39
45
 
40
46
 
@@ -50,6 +56,7 @@ class GeoSeeqUploadManager:
50
56
  overwrite=True,
51
57
  no_new_versions=False,
52
58
  num_retries=3,
59
+ ignore_errors=False,
53
60
  use_cache=True):
54
61
  self.session = session
55
62
  self.n_parallel_uploads = n_parallel_uploads
@@ -62,6 +69,7 @@ class GeoSeeqUploadManager:
62
69
  self.use_cache = use_cache
63
70
  self.threads_per_upload = threads_per_upload
64
71
  self.num_retries = num_retries
72
+ self.ignore_errors = ignore_errors
65
73
 
66
74
  def add_result_file(self, result_file, local_path):
67
75
  self._result_files.append((result_file, local_path))
@@ -87,7 +95,7 @@ class GeoSeeqUploadManager:
87
95
  self.session, self.progress_tracker_factory(local_path),
88
96
  self.link_type, self.overwrite, self.log_level,
89
97
  self.n_parallel_uploads > 1, self.use_cache, self.no_new_versions,
90
- self.threads_per_upload, self.num_retries
98
+ self.threads_per_upload, self.num_retries, self.ignore_errors
91
99
  ) for result_file, local_path in self._result_files
92
100
  ]
93
101
  out = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geoseeq
3
- Version: 0.5.6a12
3
+ Version: 0.5.6a14
4
4
  Summary: GeoSeeq command line tools and python API
5
5
  Author: David C. Danko
6
6
  Author-email: "David C. Danko" <dcdanko@biotia.io>
@@ -4,14 +4,14 @@ geoseeq/blob_constructors.py,sha256=AkWpDQY0EdGMxF1p6eRspyHKubcUdiW4it-_Q7S2QWk,
4
4
  geoseeq/bulk_creators.py,sha256=pdn-Dv7yv5SFv-PfDuQbuOnw2W4-BfIfRJVRAhM8U6s,2115
5
5
  geoseeq/constants.py,sha256=h9RURz4xs2bZyDrSGocej7ANJvRLr_H1H7JRxpNUXJM,431
6
6
  geoseeq/file_system_cache.py,sha256=HzVZWtwLD2fjWWSo_UfWmGeBltm9He4lP_OqzKwNGWg,4138
7
- geoseeq/knex.py,sha256=6fPO8F8yxgBgBXZiliMJvYYjgf_16chfJPyWLe-kpPk,7898
7
+ geoseeq/knex.py,sha256=SlK3Z9Y51APecIeJep4eNvFqlwKpQzvtokBnKe0L5Oc,7965
8
8
  geoseeq/organization.py,sha256=a9xmGDE0tQsjPJfyFkYnWagxZ8xpdeckkwvkhH6LNIk,2462
9
9
  geoseeq/pipeline.py,sha256=89mhWaecsKnm6tyRkdkaVp4dmZh62_v42Ze0oXf8OTY,9873
10
10
  geoseeq/project.py,sha256=-9Y2ik0-BpT3iqh89v8VQBbdadhI58oaUP9oZK8oetc,13741
11
11
  geoseeq/remote_object.py,sha256=Es-JlAz8iLRmCpAzh1MOwUh2MqtbuQM-p8wHIBAqNlQ,7131
12
12
  geoseeq/sample.py,sha256=whgEVk6GnDJJLjn5uTOqFqRtVxZD3BgjTo7brAC5noU,7981
13
13
  geoseeq/search.py,sha256=gawad6Cx5FxJBPlYkXWb-UKAO-UC0_yhvyU9Ca1kaNI,3388
14
- geoseeq/upload_download_manager.py,sha256=-s2Zdru_O2YWThAdmXRksIx2q8RwSOEZ2nLvm1VM4EM,7738
14
+ geoseeq/upload_download_manager.py,sha256=OOTLJQ0dHAPGzO0koF6hr4Be_lxWVc4YADjPi_uLAkY,8051
15
15
  geoseeq/user.py,sha256=tol8i1UGLRrbMw5jeJDnna1ikRgrCDd50Jxz0a1lSgg,690
16
16
  geoseeq/utils.py,sha256=PDRiEQIZYTcfEV9AYvloQVvfqs5JaebcFZodAa2SUW8,3577
17
17
  geoseeq/work_orders.py,sha256=5uLVVfdKE8qh4gGaHkdBpXJGRTujuSg59knWCqEET4A,8071
@@ -22,7 +22,7 @@ geoseeq/cli/detail.py,sha256=q8Suu-j2k18knfSVFG-SWWGNsKM-n8y9RMA3LcIIi9Y,4132
22
22
  geoseeq/cli/download.py,sha256=_upzZo08K0fAPbEsyi1uN0HGNUaY1pl6OoGPcWmvSUY,17765
23
23
  geoseeq/cli/fastq_utils.py,sha256=-bmeQLaiMBm57zWOF0R5OlWTU0_3sh1JBC1RYw2BOFM,3083
24
24
  geoseeq/cli/get_eula.py,sha256=79mbUwyiF7O1r0g6UTxG9kJGQEqKuH805E6eLkPC6Y4,997
25
- geoseeq/cli/main.py,sha256=lqRT8Y62SqLQs9J_P7TCZIZ9CGk6sMphKOALz9TSQ0o,3260
25
+ geoseeq/cli/main.py,sha256=pvnUIUYphiA6YJ4DcZ2Zz3_UZMwV-rPZYHDRU2jrj_I,3260
26
26
  geoseeq/cli/manage.py,sha256=wGXAcVaXqE5JQEU8Jh6OlHr02nB396bpS_SFcOZdrEo,5929
27
27
  geoseeq/cli/progress_bar.py,sha256=p1Xl01nkYxSBZCB30ue2verIIi22W93m3ZAMAxipD0g,738
28
28
  geoseeq/cli/run.py,sha256=bx2AV6VIqOSTlxUda78xl0XxcZ8TXlQx02-e7iLQPwI,3838
@@ -37,7 +37,7 @@ geoseeq/cli/shared_params/id_handlers.py,sha256=501K9sCVkI0YGDQ62vXk_DM5lMMDrdB5
37
37
  geoseeq/cli/shared_params/obj_getters.py,sha256=ZSkt6LnDkVFlNVYKgLrjzg60-6BthZMr3eeD3HNqzac,2741
38
38
  geoseeq/cli/shared_params/opts_and_args.py,sha256=LrDkv9WtUryM4uUMXPRk04-EBcTQ7q5V6Yu-XRDUvvA,2083
39
39
  geoseeq/cli/upload/__init__.py,sha256=3C9_S9t7chmYU-2ot89NV03x-EtmsjibulErKaU9w1k,627
40
- geoseeq/cli/upload/upload.py,sha256=whhj-cX324_N_IQKuR3t-Zw4BFzDz7NHzMrmWg5aqiE,9688
40
+ geoseeq/cli/upload/upload.py,sha256=qlIkqpTRwLlyt41XHcUFJlEPLGQHaBYZi-hpJjeD88U,9824
41
41
  geoseeq/cli/upload/upload_advanced.py,sha256=Jq5eGe-wOdrzxGWVwaFPg0BAJcW0YSx_eHEmYjJeKuA,3434
42
42
  geoseeq/cli/upload/upload_reads.py,sha256=EMGqyZf11xwN4v2j8gNxMagTbE4kaOd-_hwupmg5I-8,10670
43
43
  geoseeq/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -64,7 +64,7 @@ geoseeq/plotting/map/overlay.py,sha256=4VmxqOESTQra9tPr8b8OLEUhJSit9lNipabeSznEY
64
64
  geoseeq/result/__init__.py,sha256=IFHIyRV8ZzuKIfwfze1SXgcKwNMcSgMAknLHMkwjXIU,356
65
65
  geoseeq/result/bioinfo.py,sha256=QQtbyogrdro9avJSN0713sxLVnVeA24mFw3hWtKDKyw,1782
66
66
  geoseeq/result/file_download.py,sha256=vbYo2B4JshTIqLaklcgcBb7NY9cD5pMkas95GuQxW8s,5776
67
- geoseeq/result/file_upload.py,sha256=qQ2F28W6ieLoEsbqCWr61cQ8hYlNaKkhn4DBQ5xqR-I,13214
67
+ geoseeq/result/file_upload.py,sha256=qkJug2ptmfBwmuz577DtPG_Z7eLTtatJzycSjE1UTXk,13430
68
68
  geoseeq/result/result_file.py,sha256=1Yj9fkZhds3J-tay6eNH2-EHi00MovHGV1M80_ckHD8,8677
69
69
  geoseeq/result/result_folder.py,sha256=6porOXPh7Tpxw3oX5yMRPYQzNCGYqszqmFJd3SwQmTc,11122
70
70
  geoseeq/result/utils.py,sha256=C-CxGzB3WddlnRiqFSkrY78I_m0yFgNqsTBRzGU-y8Q,2772
@@ -80,9 +80,9 @@ geoseeq/vc/vc_stub.py,sha256=IQr8dI0zsWKVAeY_5ybDD6n49_3othcgfHS3P0O9tuY,3110
80
80
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
81
  tests/test_api_client.py,sha256=TS5njc5pcPP_Ycy-ljcfPVT1hQRBsFVdQ0lCqBmoesU,12810
82
82
  tests/test_plotting.py,sha256=TcTu-2ARr8sxZJ7wPQxmbs3-gHw7uRvsgrhhhg0qKik,784
83
- geoseeq-0.5.6a12.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
84
- geoseeq-0.5.6a12.dist-info/METADATA,sha256=DTEadRCMzytqJtg9vPNagyrMCY8l8gIslgIr7PaOA1o,4806
85
- geoseeq-0.5.6a12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
86
- geoseeq-0.5.6a12.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
87
- geoseeq-0.5.6a12.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
88
- geoseeq-0.5.6a12.dist-info/RECORD,,
83
+ geoseeq-0.5.6a14.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
84
+ geoseeq-0.5.6a14.dist-info/METADATA,sha256=Y8gauUJ3fr2WUwnpXiYEOdFayG523uz2mUY0bTIXdyk,4806
85
+ geoseeq-0.5.6a14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
86
+ geoseeq-0.5.6a14.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
87
+ geoseeq-0.5.6a14.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
88
+ geoseeq-0.5.6a14.dist-info/RECORD,,