-
Notifications
You must be signed in to change notification settings - Fork 192
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
Allow templating inside prepend_text
and append_text
#5949
Comments
This comment is a bit tangential (I can move it to a separate issue): On the OMP_NUM_THREADS topic, in reviewing https://github.com/aiidateam/aiida-core/pull/5948/files I was surprised to discover that the aiida-core/aiida/schedulers/plugins/direct.py Lines 160 to 161 in f581309
Other scheduler plugins currently do not do that, e.g. SLURM will limit the number of tasks per CPU but not set aiida-core/aiida/schedulers/plugins/slurm.py Lines 354 to 355 in f581309
We may want to think about what is the best default behavior and then be consistent across scheduler plugins. |
That was added in #5126 which was released with v2.0.0. It was proposed by @dev-zero I opened this issue and #5948 following questions on Slack. They also stumbled over the difference between If we can find a more generic method of automatically setting |
This feature would be beneficial for our use case, as the scheduler we've been using requires this environment variable to be set within the jobscript. I believe that torque requires this environment variable to be specified, as the resources allocation does not specify a Additionally, codes that can use environment variables to specify runtime modes benefit greatly from this. Though ideally one would be able to update the As a specific example, BigDFT can utilise a The simplest way to put this is that for me it lines up with what I would expect based on the defaults that already contain this syntax when creating a computer: Sorry for the delay in responding! |
This is probably not going to happen as it would require messing with AiiDA's provenance principle and allowing stored inputs to be mutated. This is too big of a change for this kind of problem I would say.
At least for this case, you can add in your plugin documentation that the user can specify builder.metadata.options.environment_variables = {'FUTILE_DEBUG_MODE': 'ERROR'} Even though it maybe might be nicer to define a custom input on your process class and have the plugin set this, that is currently not possible and this approach is available.
Fully agree, and I think this issue should address this either by adding templating support for all attributes, or making it very clear where templating is supported and which placeholders, which is currently not documented I believe. |
Indeed this makes sense, there's no reason to make such a large shift in the aiida api for this issue. I would assume that tweaks to the jobscript wouldn't affect provenance, but I trust your word that it does (or is at least a breaking change to make it so that it doesn't). Although unless I'm misunderstanding something, does this represent a bug in the torque scheduler? I believe
Obviously the former case is preferable, however making it clear that templating is supported only in specific instances would be beneficial in preventing someone else getting lost down this rabbit hole! On that note, it may also be helpful to add a note to the documentation here. Something to warn that when accessing these attributes within the plugin, what's returned are just copies, and serve a solely read-only purpose. |
That I don't know. I am not familiar with torque whatsoever. |
I believe it does, similar to how it requires the
So it seems this can be worked around presently by setting the mpirun command. It's then to be decided whether or not it would be preferable to have |
Note, this feature request is different from #4680 as in that asks how the configuration yamls that are consumed by
verdi computer setup
andverdi code create
can use templating, but the template would be made concrete before passing it to the CLI command.Here, the request is to add literal template code to the
prepend_text
andappend_text
, that is rendered upon the submission of aCalcJob
using theComputer
orCode
in question. There already is some support for this but it is quite ad-hoc. For example, theComputer.work_dir
attribute allows{username}
andCommand.mpirun_command
allows the{tot_num_mpiprocs}
.There are other use cases for this kind of functionality in other attributes, such as the
prepend_text
. For example, one may want to define a path based on the username:or to dynamically set the
OMP_NUM_THREADS
variable based on the number of CPUs per MPI task requested:We should see whether it would be possible to provide templating, how generic it can be made (should we allow full Jinja2 templates and even allow control structures, like conditionals and loops?) and how should the template variables be defined on launch time of the
CalcJob
.The text was updated successfully, but these errors were encountered: