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