mirror of
https://github.com/clearml/clearml-agent
synced 2025-01-31 17:16:51 +00:00
Support poetry when agent is installed inside virtualenv
This commit is contained in:
parent
eb012f5c24
commit
ae2775f7b8
@ -1,7 +1,9 @@
|
|||||||
|
from copy import deepcopy
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
from pathlib2 import Path
|
from pathlib2 import Path
|
||||||
from trains_agent.helper.process import Argv, DEVNULL, check_if_command_exists
|
from trains_agent.helper.process import Argv, DEVNULL, check_if_command_exists
|
||||||
from trains_agent.session import Session, POETRY
|
from trains_agent.session import Session, POETRY
|
||||||
@ -56,6 +58,9 @@ class PoetryConfig:
|
|||||||
def run(self, *args, **kwargs):
|
def run(self, *args, **kwargs):
|
||||||
func = kwargs.pop("func", Argv.get_output)
|
func = kwargs.pop("func", Argv.get_output)
|
||||||
kwargs.setdefault("stdin", DEVNULL)
|
kwargs.setdefault("stdin", DEVNULL)
|
||||||
|
kwargs['env'] = deepcopy(os.environ)
|
||||||
|
kwargs['env'].pop('VIRTUAL_ENV', None)
|
||||||
|
kwargs['env'].pop('CONDA_PREFIX', None)
|
||||||
if check_if_command_exists("poetry"):
|
if check_if_command_exists("poetry"):
|
||||||
argv = Argv("poetry", *args)
|
argv = Argv("poetry", *args)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user