Skip to content

Commit

Permalink
use cwd in nbrunner and nbdeployer (#2088)
Browse files Browse the repository at this point in the history
* use cwd in nbrunner and nbdeployer

* address nits
  • Loading branch information
madhur-ob authored Oct 9, 2024
1 parent 294671a commit 3171308
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions metaflow/runner/nbdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from metaflow import Deployer
from metaflow.runner.utils import get_current_cell, format_flowfile

DEFAULT_DIR = tempfile.gettempdir()


class NBDeployerInitializationError(Exception):
"""Custom exception for errors during NBDeployer initialization."""
Expand Down Expand Up @@ -46,8 +44,8 @@ class NBDeployer(object):
Additional environment variables to set. This overrides the
environment set for this process.
base_dir : Optional[str], default None
The directory to run the subprocess in; if not specified, a temporary
directory is used.
The directory to run the subprocess in; if not specified, the current
working directory is used.
**kwargs : Any
Additional arguments that you would pass to `python myflow.py` i.e. options
listed in `python myflow.py --help`
Expand All @@ -60,7 +58,7 @@ def __init__(
show_output: bool = True,
profile: Optional[str] = None,
env: Optional[Dict] = None,
base_dir: str = DEFAULT_DIR,
base_dir: Optional[str] = None,
file_read_timeout: int = 3600,
**kwargs,
):
Expand All @@ -78,7 +76,7 @@ def __init__(
self.show_output = show_output
self.profile = profile
self.env = env
self.cwd = base_dir
self.cwd = base_dir if base_dir is not None else os.getcwd()
self.file_read_timeout = file_read_timeout
self.top_level_kwargs = kwargs

Expand Down
10 changes: 4 additions & 6 deletions metaflow/runner/nbrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from metaflow import Runner
from metaflow.runner.utils import get_current_cell, format_flowfile

DEFAULT_DIR = tempfile.gettempdir()


class NBRunnerInitializationError(Exception):
"""Custom exception for errors during NBRunner initialization."""
Expand Down Expand Up @@ -43,8 +41,8 @@ class NBRunner(object):
Additional environment variables to set for the Run. This overrides the
environment set for this process.
base_dir : Optional[str], default None
The directory to run the subprocess in; if not specified, a temporary
directory is used.
The directory to run the subprocess in; if not specified, the current
working directory is used.
file_read_timeout : int, default 3600
The timeout until which we try to read the runner attribute file.
**kwargs : Any
Expand All @@ -59,7 +57,7 @@ def __init__(
show_output: bool = True,
profile: Optional[str] = None,
env: Optional[Dict] = None,
base_dir: str = DEFAULT_DIR,
base_dir: Optional[str] = None,
file_read_timeout: int = 3600,
**kwargs,
):
Expand All @@ -84,7 +82,7 @@ def __init__(
if profile:
self.env_vars["METAFLOW_PROFILE"] = profile

self.base_dir = base_dir
self.base_dir = base_dir if base_dir is not None else os.getcwd()
self.file_read_timeout = file_read_timeout

if not self.cell:
Expand Down

0 comments on commit 3171308

Please sign in to comment.