mirror of
https://github.com/clearml/clearml
synced 2025-02-07 13:23:40 +00:00
Fix PY2 compatibility
This commit is contained in:
parent
8e31e789b4
commit
e47f570ce5
@ -562,7 +562,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
||||
def completed(self, ignore_errors=True):
|
||||
# type: (bool) -> ()
|
||||
"""
|
||||
.. note:: Deprecated in 1.1.0
|
||||
.. note:: Deprecated, use mark_completed(...) instead
|
||||
"""
|
||||
warnings.warn("'completed' is deprecated; use 'mark_completed' instead.", DeprecationWarning)
|
||||
return self.mark_completed(ignore_errors=ignore_errors)
|
||||
|
@ -104,7 +104,7 @@ class PatchClick:
|
||||
if 'args' in kwargs:
|
||||
kwargs['args'] = init_args
|
||||
else:
|
||||
args = (args[0], init_args, *args[2:])
|
||||
args = (args[0], init_args) + args[2:]
|
||||
|
||||
ret = original_fn(self, *args, **kwargs)
|
||||
|
@ -18,7 +18,7 @@ try:
|
||||
except ImportError:
|
||||
from collections import Sequence as CollectionsSequence
|
||||
|
||||
from typing import Optional, Union, Mapping, Sequence, Any, Dict, Iterable, TYPE_CHECKING, Callable
|
||||
from typing import Optional, Union, Mapping, Sequence, Any, Dict, Iterable, TYPE_CHECKING, Callable, Tuple
|
||||
|
||||
import psutil
|
||||
import six
|
||||
@ -630,22 +630,22 @@ class Task(_Task):
|
||||
@classmethod
|
||||
def create(
|
||||
cls,
|
||||
project_name=None, # Optional[str]
|
||||
task_name=None, # Optional[str]
|
||||
task_type=None, # Optional[str]
|
||||
repo=None, # Optional[str]
|
||||
branch=None, # Optional[str]
|
||||
commit=None, # Optional[str]
|
||||
script=None, # Optional[str]
|
||||
working_directory=None, # Optional[str]
|
||||
packages=None, # Optional[Union[bool, Sequence[str]]]
|
||||
requirements_file=None, # Optional[Union[str, Path]]
|
||||
docker=None, # Optional[str]
|
||||
docker_args=None, # Optional[str]
|
||||
docker_bash_setup_script=None, # Optional[str]
|
||||
argparse_args=None, # Optional[Sequence[Tuple[str, str]]]
|
||||
base_task_id=None, # Optional[str]
|
||||
add_task_init_call=True, # bool
|
||||
project_name=None, # type: Optional[str]
|
||||
task_name=None, # type: Optional[str]
|
||||
task_type=None, # type: Optional[str]
|
||||
repo=None, # type: Optional[str]
|
||||
branch=None, # type: Optional[str]
|
||||
commit=None, # type: Optional[str]
|
||||
script=None, # type: Optional[str]
|
||||
working_directory=None, # type: Optional[str]
|
||||
packages=None, # type: Optional[Union[bool, Sequence[str]]]
|
||||
requirements_file=None, # type: Optional[Union[str, Path]]
|
||||
docker=None, # type: Optional[str]
|
||||
docker_args=None, # type: Optional[str]
|
||||
docker_bash_setup_script=None, # type: Optional[str]
|
||||
argparse_args=None, # type: Optional[Sequence[Tuple[str, str]]]
|
||||
base_task_id=None, # type: Optional[str]
|
||||
add_task_init_call=True, # type: bool
|
||||
):
|
||||
# type: (...) -> Task
|
||||
"""
|
||||
|
@ -7,7 +7,7 @@ from multiprocessing import Lock, Event as ProcessEvent
|
||||
from threading import Thread, Event as TrEvent
|
||||
from time import sleep, time
|
||||
from typing import List, Dict, Optional
|
||||
from multiprocessing import Process, get_context
|
||||
from multiprocessing import Process
|
||||
|
||||
import psutil
|
||||
from six.moves.queue import Empty, Queue as TrQueue
|
||||
@ -19,11 +19,19 @@ try:
|
||||
except ImportError:
|
||||
from multiprocessing.queues import SimpleQueue
|
||||
|
||||
# Windows/MacOS compatibility
|
||||
try:
|
||||
from multiprocessing.context import ForkContext # noqa
|
||||
except ImportError:
|
||||
ForkContext = None
|
||||
|
||||
# PY2 compatibility
|
||||
try:
|
||||
from multiprocessing import get_context
|
||||
except ImportError:
|
||||
def get_context(*args, **kwargs):
|
||||
return False
|
||||
|
||||
|
||||
class ThreadCalls(object):
|
||||
def __init__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user