diff --git a/metaflow/plugins/aws/batch/batch.py b/metaflow/plugins/aws/batch/batch.py index 833e97801a..7e19c422cf 100644 --- a/metaflow/plugins/aws/batch/batch.py +++ b/metaflow/plugins/aws/batch/batch.py @@ -27,8 +27,8 @@ from .batch_client import BatchClient -# Redirect structured logs to /logs/ -LOGS_DIR = "/logs" +# Redirect structured logs to $PWD/.logs/ +LOGS_DIR = "$PWD/.logs" STDOUT_FILE = "mflog_stdout" STDERR_FILE = "mflog_stderr" STDOUT_PATH = os.path.join(LOGS_DIR, STDOUT_FILE) @@ -71,7 +71,8 @@ def _command(self, environment, code_package_url, step_name, step_cmds, task_spe # the `true` command is to make sure that the generated command # plays well with docker containers which have entrypoint set as # eval $@ - cmd_str = "true && mkdir -p /logs && %s && %s && %s; " % ( + cmd_str = "true && mkdir -p %s && %s && %s && %s; " % ( + LOGS_DIR, mflog_expr, init_expr, step_expr, diff --git a/metaflow/plugins/aws/eks/kubernetes.py b/metaflow/plugins/aws/eks/kubernetes.py index eb61c006fa..c908020e6a 100644 --- a/metaflow/plugins/aws/eks/kubernetes.py +++ b/metaflow/plugins/aws/eks/kubernetes.py @@ -28,8 +28,8 @@ from .kubernetes_client import KubernetesClient -# Redirect structured logs to /logs/ -LOGS_DIR = "/logs" +# Redirect structured logs to $PWD/.logs/ +LOGS_DIR = "$PWD/.logs" STDOUT_FILE = "mflog_stdout" STDERR_FILE = "mflog_stderr" STDOUT_PATH = os.path.join(LOGS_DIR, STDOUT_FILE) @@ -148,7 +148,8 @@ def _command( # The `true` command is to make sure that the generated command # plays well with docker containers which have entrypoint set as # eval $@ - cmd_str = "true && mkdir -p /logs && %s && %s && %s; " % ( + cmd_str = "true && mkdir -p %s && %s && %s && %s; " % ( + LOGS_DIR, mflog_expr, init_expr, step_expr,