Skip to content

Commit

Permalink
activate context modules only in run.py
Browse files Browse the repository at this point in the history
when the context is built from the database, really for execution
(#338)
  • Loading branch information
denisri committed Nov 27, 2023
1 parent 266cd6a commit 177575b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions capsul/engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ def execution_context(engine_label, engine_config, executable):
)
setattr(execution_context, module_name, valid_config)

# FIXME: should be done only in real execution (server) situation
execution_context.activate_modules_config()
# context activation should be done only in real execution (server)
# situation. This is done in database.execution_context(), not here
# because here we are on client-side API.
# execution_context.activate_modules_config()

return execution_context

Expand Down
2 changes: 1 addition & 1 deletion capsul/execution_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ExecutionContext(Controller):
config_modules: list[str] = field(type=list[str], default_factory=list)
dataset: OpenKeyDictController[Dataset]

def __init__(self, config=None, executable=None, activate_modules=True):
def __init__(self, config=None, executable=None, activate_modules=False):
super().__init__()
if config:
python_modules = config.get("python_modules", [])
Expand Down
2 changes: 2 additions & 0 deletions capsul/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ def run_job(


def execute_job(database, engine_id, execution_id, job_uuid, debug=False):
# TODO: the context should be specific to the job, not only the execution
execution_context = database.execution_context(engine_id, execution_id)
execution_context.dataset.tmp = {
"path": database.tmp(engine_id, execution_id),
}
execution_context.activate_modules_config()
job = database.job(engine_id, execution_id, job_uuid)
if job is None:
raise ValueError(f"No such job: {job_uuid}")
Expand Down

0 comments on commit 177575b

Please sign in to comment.