pybiolib 1.1.2003__py3-none-any.whl → 1.1.2011__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_result.py +25 -5
- {pybiolib-1.1.2003.dist-info → pybiolib-1.1.2011.dist-info}/METADATA +1 -1
- {pybiolib-1.1.2003.dist-info → pybiolib-1.1.2011.dist-info}/RECORD +6 -6
- {pybiolib-1.1.2003.dist-info → pybiolib-1.1.2011.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.2003.dist-info → pybiolib-1.1.2011.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.2003.dist-info → pybiolib-1.1.2011.dist-info}/entry_points.txt +0 -0
biolib/jobs/job_result.py
CHANGED
@@ -34,7 +34,9 @@ class JobResult:
|
|
34
34
|
def get_exit_code(self) -> int:
|
35
35
|
return self._get_module_output().get_exit_code()
|
36
36
|
|
37
|
-
def save_files(
|
37
|
+
def save_files(
|
38
|
+
self, output_dir: str, path_filter: Optional[PathFilter] = None, skip_file_if_exists: Optional[bool] = None
|
39
|
+
) -> None:
|
38
40
|
module_output = self._get_module_output()
|
39
41
|
output_files = module_output.get_files()
|
40
42
|
filtered_output_files = self._get_filtered_files(output_files, path_filter) if path_filter else output_files
|
@@ -60,15 +62,33 @@ class JobResult:
|
|
60
62
|
# Remove leading slash of file_path
|
61
63
|
destination_file_path = Path(output_dir) / Path(file.path.lstrip('/'))
|
62
64
|
if destination_file_path.exists():
|
63
|
-
|
65
|
+
if skip_file_if_exists:
|
66
|
+
print(f'Skipping {destination_file_path} as a file with that name already exists locally.')
|
67
|
+
continue
|
68
|
+
else:
|
69
|
+
destination_file_path.rename(
|
70
|
+
f'{destination_file_path}.biolib-renamed.{time.strftime("%Y%m%d%H%M%S")}'
|
71
|
+
)
|
64
72
|
|
65
73
|
dir_path = destination_file_path.parent
|
66
74
|
if dir_path:
|
67
75
|
dir_path.mkdir(parents=True, exist_ok=True)
|
68
76
|
|
69
|
-
|
70
|
-
|
71
|
-
|
77
|
+
# write content to temporary (partial) file
|
78
|
+
partial_path = destination_file_path.with_suffix(f'.{self._job_uuid}.partial_biolib_download')
|
79
|
+
file_start = file.start
|
80
|
+
data_to_download = file.length
|
81
|
+
if partial_path.exists():
|
82
|
+
data_already_downloaded = partial_path.stat().st_size
|
83
|
+
file_start += data_already_downloaded
|
84
|
+
data_to_download -= data_already_downloaded
|
85
|
+
|
86
|
+
with open(partial_path, mode='ab') as partial_file:
|
87
|
+
for chunk in stream_seeker.seek_and_read(file_start=file_start, file_length=data_to_download):
|
88
|
+
partial_file.write(chunk)
|
89
|
+
|
90
|
+
# rename partial file to actual file name
|
91
|
+
partial_path.rename(destination_file_path)
|
72
92
|
|
73
93
|
def get_output_file(self, filename) -> LazyLoadedFile:
|
74
94
|
files = self._get_module_output().get_files()
|
@@ -90,7 +90,7 @@ biolib/experiments/experiment.py,sha256=_ied3A3U6NFa6_ewEYn2TCozqeHvDxDqdRhMtZbF
|
|
90
90
|
biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
|
91
91
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
92
92
|
biolib/jobs/job.py,sha256=aWKnf_2pYdr76gh3hxPiVs2iuXlpwZkKPTK81Pz4G2U,19072
|
93
|
-
biolib/jobs/job_result.py,sha256=
|
93
|
+
biolib/jobs/job_result.py,sha256=IaSKb9B33zTnMq8CQBRB8_FTc8uYqJU8Amag8bcwyvE,5799
|
94
94
|
biolib/jobs/types.py,sha256=qhadtH2KDC2WUOOqPiwke0YgtQY4FtuB71Stekq1k48,970
|
95
95
|
biolib/lfs/__init__.py,sha256=Qv8vdYeK43JecT4SsE93ZYE2VmNiZENdNpW8P9-omxs,115
|
96
96
|
biolib/lfs/cache.py,sha256=pQS2np21rdJ6I3DpoOutnzPHpLOZgUIS8TMltUJk_k4,2226
|
@@ -109,8 +109,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
109
109
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
110
110
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
111
111
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
112
|
-
pybiolib-1.1.
|
113
|
-
pybiolib-1.1.
|
114
|
-
pybiolib-1.1.
|
115
|
-
pybiolib-1.1.
|
116
|
-
pybiolib-1.1.
|
112
|
+
pybiolib-1.1.2011.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.2011.dist-info/METADATA,sha256=nzajC4HmYF0zf_amvrcgobGbTs-_DAp2pmfKkoRvG50,1508
|
114
|
+
pybiolib-1.1.2011.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.2011.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.2011.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|