mirror of
https://github.com/clearml/clearml
synced 2025-03-03 18:52:12 +00:00
Fix Windows support
This commit is contained in:
parent
4c15613250
commit
2bbf46a273
@ -43,14 +43,17 @@ class PatchOsFork(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def patch_fork(cls):
|
def patch_fork(cls):
|
||||||
# only once
|
try:
|
||||||
if cls._original_fork:
|
# only once
|
||||||
return
|
if cls._original_fork:
|
||||||
if six.PY2:
|
return
|
||||||
cls._original_fork = staticmethod(os.fork)
|
if six.PY2:
|
||||||
else:
|
cls._original_fork = staticmethod(os.fork)
|
||||||
cls._original_fork = os.fork
|
else:
|
||||||
os.fork = cls._patched_fork
|
cls._original_fork = os.fork
|
||||||
|
os.fork = cls._patched_fork
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _patched_fork(*args, **kwargs):
|
def _patched_fork(*args, **kwargs):
|
||||||
@ -72,7 +75,7 @@ class PatchOsFork(object):
|
|||||||
return os._org_exit(*args, **kwargs)
|
return os._org_exit(*args, **kwargs)
|
||||||
|
|
||||||
if not hasattr(os, '_org_exit'):
|
if not hasattr(os, '_org_exit'):
|
||||||
os._org_exit = os._exit
|
os._org_exit = os._exit
|
||||||
os._exit = _at_exit_callback
|
os._exit = _at_exit_callback
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import atexit
|
import atexit
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
@ -9,6 +10,7 @@ from collections import OrderedDict, Callable
|
|||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
import six
|
import six
|
||||||
|
from pathlib2 import Path
|
||||||
|
|
||||||
from .binding.joblib_bind import PatchedJoblib
|
from .binding.joblib_bind import PatchedJoblib
|
||||||
from .backend_api.services import tasks, projects
|
from .backend_api.services import tasks, projects
|
||||||
@ -334,21 +336,18 @@ class Task(_Task):
|
|||||||
result = ScriptInfo.get(create_requirements=False, check_uncommitted=False)
|
result = ScriptInfo.get(create_requirements=False, check_uncommitted=False)
|
||||||
if result:
|
if result:
|
||||||
if not default_project_name:
|
if not default_project_name:
|
||||||
# noinspection PyBroadException
|
|
||||||
try:
|
try:
|
||||||
parts = result.script['repository'].split('/')
|
default_project_name = re.sub(r"\.git$", "", result.script.get('repository')) or "Untitled"
|
||||||
default_project_name = (parts[-1] or parts[-2]).replace('.git', '') or 'Untitled'
|
except TypeError:
|
||||||
except Exception:
|
|
||||||
default_project_name = 'Untitled'
|
default_project_name = 'Untitled'
|
||||||
if not default_task_name:
|
if not default_task_name:
|
||||||
# noinspection PyBroadException
|
|
||||||
try:
|
try:
|
||||||
default_task_name = os.path.splitext(os.path.basename(result.script['entry_point']))[0]
|
default_task_name = Path(result.script.get("entry_point")).stem
|
||||||
except Exception:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# if we force no task reuse from os environment
|
# if we force no task reuse from os environment
|
||||||
if DEV_TASK_NO_REUSE.get() or reuse_last_task_id:
|
if DEV_TASK_NO_REUSE.get() or not reuse_last_task_id:
|
||||||
default_task = None
|
default_task = None
|
||||||
else:
|
else:
|
||||||
# if we have a previous session to use, get the task id from it
|
# if we have a previous session to use, get the task id from it
|
||||||
|
Loading…
Reference in New Issue
Block a user