mirror of
https://github.com/clearml/clearml
synced 2025-04-02 12:08:33 +00:00
Fix python 2.7 support
This commit is contained in:
parent
0c5d12b830
commit
59932e4f4c
@ -1,7 +1,7 @@
|
||||
import base64
|
||||
import os
|
||||
from os.path import expandvars, expanduser
|
||||
from pathlib import Path
|
||||
from pathlib2 import Path
|
||||
from typing import List, TYPE_CHECKING
|
||||
|
||||
from ..utilities.pyhocon import HOCONConverter, ConfigTree
|
||||
|
@ -705,11 +705,13 @@ class ScriptInfo(object):
|
||||
@classmethod
|
||||
def _get_entry_point(cls, repo_root, script_path):
|
||||
repo_root = Path(repo_root).absolute()
|
||||
script_path = Path(script_path)
|
||||
|
||||
try:
|
||||
# Use os.path.relpath as it calculates up dir movements (../)
|
||||
entry_point = os.path.relpath(
|
||||
str(os.path.realpath(script_path)), str(cls._get_working_dir(repo_root, return_abs=True)))
|
||||
str(os.path.realpath(script_path.as_posix())),
|
||||
str(cls._get_working_dir(repo_root, return_abs=True)))
|
||||
except ValueError:
|
||||
# Working directory not under repository root
|
||||
entry_point = script_path.relative_to(repo_root)
|
||||
|
@ -2206,7 +2206,8 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
||||
|
||||
# make sure we have str as values:
|
||||
for key in requirements.keys():
|
||||
if requirements[key] and not isinstance(requirements[key], str):
|
||||
# fix python2 support (str/unicode)
|
||||
if requirements[key] and not isinstance(requirements[key], six.string_types):
|
||||
requirements[key] = '\n'.join(requirements[key])
|
||||
|
||||
# protection, Old API might not support it
|
||||
|
@ -1558,7 +1558,8 @@ class Dataset(object):
|
||||
raise ValueError("Dataset selection criteria not met. Didn't provide id/name/project/tags correctly.")
|
||||
if not alias:
|
||||
LoggerRoot.get_base_logger().info(
|
||||
"Dataset.get() did not specify alias. Dataset information won’t be automatically logged in ClearML Server.")
|
||||
"Dataset.get() did not specify alias. Dataset information "
|
||||
"will not be automatically logged in ClearML Server.")
|
||||
|
||||
mutually_exclusive(dataset_id=dataset_id, dataset_project=dataset_project, _require_at_least_one=False)
|
||||
mutually_exclusive(dataset_id=dataset_id, dataset_name=dataset_name, _require_at_least_one=False)
|
||||
|
Loading…
Reference in New Issue
Block a user