Skip to content

Commit 177575b

Browse files
committed
activate context modules only in run.py
when the context is built from the database, really for execution (#338)
1 parent 266cd6a commit 177575b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

capsul/engine/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ def execution_context(engine_label, engine_config, executable):
8484
)
8585
setattr(execution_context, module_name, valid_config)
8686

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

9092
return execution_context
9193

capsul/execution_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ExecutionContext(Controller):
2525
config_modules: list[str] = field(type=list[str], default_factory=list)
2626
dataset: OpenKeyDictController[Dataset]
2727

28-
def __init__(self, config=None, executable=None, activate_modules=True):
28+
def __init__(self, config=None, executable=None, activate_modules=False):
2929
super().__init__()
3030
if config:
3131
python_modules = config.get("python_modules", [])

capsul/run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ def run_job(
5454

5555

5656
def execute_job(database, engine_id, execution_id, job_uuid, debug=False):
57+
# TODO: the context should be specific to the job, not only the execution
5758
execution_context = database.execution_context(engine_id, execution_id)
5859
execution_context.dataset.tmp = {
5960
"path": database.tmp(engine_id, execution_id),
6061
}
62+
execution_context.activate_modules_config()
6163
job = database.job(engine_id, execution_id, job_uuid)
6264
if job is None:
6365
raise ValueError(f"No such job: {job_uuid}")

0 commit comments

Comments
 (0)