mirror of
https://github.com/clearml/clearml
synced 2025-02-07 21:33:25 +00:00
Fix artifacts support on Windows
This commit is contained in:
parent
adbe02b62b
commit
6fffb33931
@ -282,13 +282,21 @@ class Artifacts(object):
|
|||||||
artifact_object = Path(artifact_object)
|
artifact_object = Path(artifact_object)
|
||||||
|
|
||||||
artifact_object.expanduser().absolute()
|
artifact_object.expanduser().absolute()
|
||||||
create_zip_file = not artifact_object.is_file()
|
try:
|
||||||
if artifact_object.is_dir():
|
create_zip_file = not artifact_object.is_file()
|
||||||
# change to wildcard
|
except Exception: # Hack for windows pathlib2 bug, is_file isn't valid.
|
||||||
artifact_object = artifact_object / '*'
|
create_zip_file = True
|
||||||
|
else: # We assume that this is not Windows os
|
||||||
|
if artifact_object.is_dir():
|
||||||
|
# change to wildcard
|
||||||
|
artifact_object /= '*'
|
||||||
|
|
||||||
if create_zip_file:
|
if create_zip_file:
|
||||||
folder = Path('').joinpath(*artifact_object.parts[:-1])
|
folder = Path('').joinpath(*artifact_object.parts[:-1])
|
||||||
|
if not folder.is_dir():
|
||||||
|
raise ValueError("Artifact file/folder '{}' could not be found".format(
|
||||||
|
artifact_object.as_posix()))
|
||||||
|
|
||||||
wildcard = artifact_object.parts[-1]
|
wildcard = artifact_object.parts[-1]
|
||||||
files = list(Path(folder).rglob(wildcard))
|
files = list(Path(folder).rglob(wildcard))
|
||||||
override_filename_ext_in_uri = '.zip'
|
override_filename_ext_in_uri = '.zip'
|
||||||
@ -319,6 +327,9 @@ class Artifacts(object):
|
|||||||
local_filename = artifact_object
|
local_filename = artifact_object
|
||||||
delete_after_upload = True
|
delete_after_upload = True
|
||||||
else:
|
else:
|
||||||
|
if not artifact_object.is_file():
|
||||||
|
raise ValueError("Artifact file '{}' could not be found".format(artifact_object.as_posix()))
|
||||||
|
|
||||||
override_filename_in_uri = artifact_object.parts[-1]
|
override_filename_in_uri = artifact_object.parts[-1]
|
||||||
artifact_object = artifact_object.as_posix()
|
artifact_object = artifact_object.as_posix()
|
||||||
artifact_type = 'custom'
|
artifact_type = 'custom'
|
||||||
|
Loading…
Reference in New Issue
Block a user