You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
occationally it would be nice to be able parse values from an options_form into my batchspawner commands
c.Spawner.options_form = """
<hr>
<label for=""venv_path">Path to python venv</label>
<input type="text" name="venv_path" />
"""
c.BatchSpawnerBase.batchspawner_singleuser_cmd = 'singularity run --nv {% if venv_path %} --env PYTHON_VENV_PATH={{venv_path}} -B {{venv_path}}:{{venv_path}}{% endif %} base.sif'
There doesn't seem to be any way for this kind of thing to be functional as format_template is never run for these values.
Alternative options
Alternatively this could probably be achived using spawner args?
or not using batchspawner_singleuser_cmd and placing the command inside the batch script? (though not sure if this works when trying to convey the port back to jupyterhub).
Who would use this feature?
Anyone trying to parse user options and arguments to their batchspawner commands.
(Optional): Suggest a solution
This is what I have used to overcome this limitation.
def cmd_formatted_for_batch(self):
"""The command which is substituted inside of the batch script"""
subvars = self.get_req_subvars()
if hasattr(self, 'user_options'):
subvars.update(self.user_options)
return ' '.join([format_template(self.batchspawner_singleuser_cmd, **subvars)] + self.cmd + self.get_args())
The text was updated successfully, but these errors were encountered:
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋
Proposed change
occationally it would be nice to be able parse values from an options_form into my batchspawner commands
There doesn't seem to be any way for this kind of thing to be functional as
format_template
is never run for these values.Alternative options
Alternatively this could probably be achived using spawner args?
or not using batchspawner_singleuser_cmd and placing the command inside the batch script? (though not sure if this works when trying to convey the port back to jupyterhub).
Who would use this feature?
Anyone trying to parse user options and arguments to their batchspawner commands.
(Optional): Suggest a solution
This is what I have used to overcome this limitation.
The text was updated successfully, but these errors were encountered: