geoseeq 0.5.6a5__py3-none-any.whl → 0.5.6a7__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 +1 -1
- geoseeq/remote_object.py +9 -0
- geoseeq/result/file_download.py +29 -10
- {geoseeq-0.5.6a5.dist-info → geoseeq-0.5.6a7.dist-info}/METADATA +1 -1
- {geoseeq-0.5.6a5.dist-info → geoseeq-0.5.6a7.dist-info}/RECORD +9 -9
- {geoseeq-0.5.6a5.dist-info → geoseeq-0.5.6a7.dist-info}/LICENSE +0 -0
- {geoseeq-0.5.6a5.dist-info → geoseeq-0.5.6a7.dist-info}/WHEEL +0 -0
- {geoseeq-0.5.6a5.dist-info → geoseeq-0.5.6a7.dist-info}/entry_points.txt +0 -0
- {geoseeq-0.5.6a5.dist-info → geoseeq-0.5.6a7.dist-info}/top_level.txt +0 -0
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.
|
56
|
+
click.echo('0.5.6a7') # remember to update setup
|
57
57
|
|
58
58
|
|
59
59
|
@main.group('advanced')
|
geoseeq/remote_object.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import logging
|
2
|
+
from pandas import to_datetime
|
2
3
|
|
3
4
|
from requests.exceptions import HTTPError
|
4
5
|
|
@@ -57,6 +58,14 @@ class RemoteObject:
|
|
57
58
|
|
58
59
|
def cache_blob(self, blob):
|
59
60
|
return self.cache.cache_blob(self, blob)
|
61
|
+
|
62
|
+
@property
|
63
|
+
def updated_at_timestamp(self):
|
64
|
+
"""Return the updated_at field as a unix timestamp (in seconds).
|
65
|
+
|
66
|
+
timestamp from servercomes as a string: '2024-03-13T09:06:56.582551Z'
|
67
|
+
"""
|
68
|
+
return to_datetime(self.updated_at).timestamp()
|
60
69
|
|
61
70
|
def load_blob(self, blob, allow_overwrite=False):
|
62
71
|
logger.debug(f"Loading blob. {blob}")
|
geoseeq/result/file_download.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import urllib.request
|
3
3
|
import logging
|
4
4
|
import requests
|
5
|
-
from os.path import basename, getsize, join, isfile
|
5
|
+
from os.path import basename, getsize, join, isfile, getmtime
|
6
6
|
from pathlib import Path
|
7
7
|
from tempfile import NamedTemporaryFile
|
8
8
|
|
@@ -82,12 +82,30 @@ class ResultFileDownload:
|
|
82
82
|
return url
|
83
83
|
else:
|
84
84
|
return self.stored_data[key]
|
85
|
+
|
86
|
+
|
87
|
+
def _download_flag_path(self, filename, flag_suffix='.gs_downloaded'):
|
88
|
+
return filename + flag_suffix
|
89
|
+
|
90
|
+
def download_needs_update(self, filename, flag_suffix='.gs_downloaded', slack=5):
|
91
|
+
"""Return True if the file needs to be downloaded, False otherwise.
|
92
|
+
|
93
|
+
If either the file or the flag file does not exist, return True.
|
94
|
+
If the flag file is older than `updated_at` in the result, return True.
|
95
|
+
Otherwise, return False.
|
96
|
+
"""
|
97
|
+
if isfile(filename) and isfile(self._download_flag_path(filename, flag_suffix)):
|
98
|
+
if self.updated_at_timestamp - getmtime(self._download_flag_path(filename, flag_suffix)) > slack:
|
99
|
+
return True
|
100
|
+
return False
|
101
|
+
return True
|
85
102
|
|
86
103
|
def download(self, filename=None, flag_suffix='.gs_downloaded', cache=True, head=None, progress_tracker=None):
|
87
104
|
"""Return a local filepath to the file in this result. Download the file if necessary.
|
88
105
|
|
89
106
|
When the file is downloaded, it is cached in the result object. Subsequent calls to download
|
90
|
-
on this object will return the cached file unless cache=False is specified
|
107
|
+
on this object will return the cached file unless cache=False is specified or the file is updated
|
108
|
+
on the server.
|
91
109
|
|
92
110
|
A flag file is created when the file download is complete. Subsequent calls to download
|
93
111
|
will return the cached file if the flag file exists unless cache=False is specified.
|
@@ -101,13 +119,14 @@ class ResultFileDownload:
|
|
101
119
|
filename = self._cached_filename
|
102
120
|
|
103
121
|
blob_type = self.stored_data.get("__type__", "").lower()
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
122
|
+
needs_update = self.download_needs_update(filename, flag_suffix)
|
123
|
+
if not needs_update:
|
124
|
+
if cache and self._cached_filename:
|
125
|
+
return self._cached_filename
|
126
|
+
if cache and flag_suffix:
|
127
|
+
# check if file and flag file exist, if so, return filename
|
128
|
+
if isfile(filename) and isfile(self._download_flag_path(filename, flag_suffix)):
|
129
|
+
return filename
|
111
130
|
|
112
131
|
url = self.get_download_url()
|
113
132
|
filepath = download_url(
|
@@ -116,7 +135,7 @@ class ResultFileDownload:
|
|
116
135
|
)
|
117
136
|
if cache and flag_suffix:
|
118
137
|
# create flag file
|
119
|
-
open(
|
138
|
+
open(self._download_flag_path(filename, flag_suffix), 'a').close()
|
120
139
|
if cache:
|
121
140
|
self._cached_filename = filepath
|
122
141
|
return filepath
|
@@ -8,7 +8,7 @@ geoseeq/knex.py,sha256=6fPO8F8yxgBgBXZiliMJvYYjgf_16chfJPyWLe-kpPk,7898
|
|
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
|
-
geoseeq/remote_object.py,sha256=
|
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
14
|
geoseeq/upload_download_manager.py,sha256=Xk5VB5qkDRZGQj6DqXOEzUmphXltF66FAVjxKWaweUE,7090
|
@@ -22,7 +22,7 @@ geoseeq/cli/detail.py,sha256=q8Suu-j2k18knfSVFG-SWWGNsKM-n8y9RMA3LcIIi9Y,4132
|
|
22
22
|
geoseeq/cli/download.py,sha256=ldpqpnRe00utb1EL1T_5CyPbFrZbtauIvOSOHtxz9qc,17656
|
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=
|
25
|
+
geoseeq/cli/main.py,sha256=ONd6tMTFSLtEQ8MiL53Ig2Gncindxmpcgm8MXBWWCE8,3259
|
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
|
@@ -63,7 +63,7 @@ geoseeq/plotting/map/map.py,sha256=h2QPLGqe-SamhfaTij53S9cQIiO8orCJUAUh0hRicSM,3
|
|
63
63
|
geoseeq/plotting/map/overlay.py,sha256=4VmxqOESTQra9tPr8b8OLEUhJSit9lNipabeSznEYwE,1795
|
64
64
|
geoseeq/result/__init__.py,sha256=IFHIyRV8ZzuKIfwfze1SXgcKwNMcSgMAknLHMkwjXIU,356
|
65
65
|
geoseeq/result/bioinfo.py,sha256=QQtbyogrdro9avJSN0713sxLVnVeA24mFw3hWtKDKyw,1782
|
66
|
-
geoseeq/result/file_download.py,sha256=
|
66
|
+
geoseeq/result/file_download.py,sha256=XQA5bdQJJSZIgbFcN09OvVdLq12fnA98kPCIONAkLk0,5568
|
67
67
|
geoseeq/result/file_upload.py,sha256=dl5T3bUNfb4JdotldAQxZV0wwYcA_XUTlHOApFl8Bgw,7390
|
68
68
|
geoseeq/result/result_file.py,sha256=HG1gKpgIcWImWuf6LduVLEOyW_auuQ-dWld8MNOXGLE,8433
|
69
69
|
geoseeq/result/result_folder.py,sha256=6porOXPh7Tpxw3oX5yMRPYQzNCGYqszqmFJd3SwQmTc,11122
|
@@ -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.
|
84
|
-
geoseeq-0.5.
|
85
|
-
geoseeq-0.5.
|
86
|
-
geoseeq-0.5.
|
87
|
-
geoseeq-0.5.
|
88
|
-
geoseeq-0.5.
|
83
|
+
geoseeq-0.5.6a7.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
|
84
|
+
geoseeq-0.5.6a7.dist-info/METADATA,sha256=2FR5sXg1kzhWv9LZHlcaKxgLUmGSeLpRdxqVZJN861A,4805
|
85
|
+
geoseeq-0.5.6a7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
86
|
+
geoseeq-0.5.6a7.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
|
87
|
+
geoseeq-0.5.6a7.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
|
88
|
+
geoseeq-0.5.6a7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|