-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute jobs in separate conda environments #1315
Conversation
Any pyiron job object which defines an external executable `job.executable` can now be executed in a separate conda environment. This is achieved by: ``` job.server.conda_environment_name = "py312" job.run() ```
It would be great if we would have python bindings for the creation of conda environments - pyiron/conda_subprocess#4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the value of the addition in principle, however, tab completion would only show create
and the getitem is hidden. Just using pr.conda_environment would only inform that this is a property.
Therefore, I would add a get method and provide a reasonable repr such that things are clear from the user perspective.
I agree a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry I misread getattr
and getitem
and was confused!
Co-authored-by: Niklas Siemer <[email protected]>
Co-authored-by: Niklas Siemer <[email protected]>
Co-authored-by: Niklas Siemer <[email protected]>
# Conflicts: # pyiron_base/jobs/job/runfunction.py
# Conflicts: # pyiron_base/project/generic.py
6bac9d6
to
18ef4dd
Compare
I did understand correctly, that you only use the other conda environment for starting the shell script running the actual computation? Or is it required that pyiron(_base) is also installed in the other conda environment? |
super().setUpClass() | ||
with open("env.yaml", "w") as f: | ||
f.writelines(conda_env) | ||
cls.project.conda_environment.create(env_name="py312", env_file="env.yaml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The creation of conda environments fails on windows, so the windows tests are skipped for now.
That is correct, only the external executable is executed in the different environment. This allows the external environments to be small and simplifies the integration on the pyiron side. Calling python functions in other conda environments is currently not supported. |
Caution: Executing pyiron_base jobs in separate conda environments introduces additional overhead. When possible it is highly recommended to create one conda environment which combines all dependencies.
Feature:
For specific application it is required to execute parts of a given workflow in separate conda environments. For example in BAMresearch/NFDI4IngScientificWorkflowRequirements. For these special cases this pull request adds the functionality to
pyiron_base
to execute individual jobs in separate conda environments. Additional conda environments can be created with theProject()
object usingpr.conda_environment.create()
and can be assigned to individual jobs usingjob.server.conda_environment_path = pr.conda_environment.py312
.Example: