https://dagster.io/ logo
#ask-community
Title
# ask-community
h

Henry

05/11/2022, 1:17 PM
Hi Team, After reading "Organizing Jobs in Repositories" I know I can put jobs in one Python file and organizing them with repository, but putting jobs in one python file meaning those jobs will have same working directory(?). What I want to achieve is that each job has its own working directory. How can I have multiple jobs with different working_directories?
d

daniel

05/11/2022, 3:08 PM
Hi Henry - the working directory is controlled by python, so it's tricky for Dagster to change this within a single Python environment. Would calling something like this within the op where you want a different working directory possibly work?
Copy code
import os
from contextlib import contextmanager

@contextmanager
def new_cwd(path):
    old = os.getcwd()
    try:
        os.chdir(path)
        yield
    finally:
        os.chdir(old)
💯 1