Open omula opened 5 years ago
There's currently a bug/quirk (more of a bug) where if you set something on one of the profiles, it needs to be set on all or else it may use the last set value. This is because the Spawner objects are saved between different executions. This isn't very nice and I hope to fix it during the JupyterHub hackathon next week.
So, for now, I would recommend just setting it everywhere. One thing I do is make a `default_profile = {'req_keepvars_extra':'LD_LIBRARY_PATH'} and then each of my profiles looks like this:
('2 cores, 4 GB, 8 hours', '4gb', 'batchspawner.SlurmSpawner',
{**default_profile, "req_runtime":'8:00:00', "req_memory":'4gb', "req_keepvars_extra":'LD_LIBRARY_PATH'}),
and then everything gets the defaults (defaults include anything that is set on any profile), and any other profile can override things.
Hopefully in 10 days this bug will be fixed...
I think I didn't explain myself very well. If I set it globally it seems is not even read/processed.
I have modified the code so that get_req_subvars prints de vars.
def get_req_subvars(self):
reqlist = [ t for t in self.trait_names() if t.startswith('req_') ]
subvars = {}
self.log.info('keepvars: ' + self.req_keepvars)
self.log.info('keepvars_extra: ' + self.req_keepvars_extra)
for t in reqlist:
subvars[t[4:]] = getattr(self, t)
if subvars.get('keepvars_extra'):
subvars['keepvars'] += ',' + subvars['keepvars_extra']
return subvars
The current configuration is
import batchspawner
c.JupyterHub.hub_ip = '0.0.0.0'
c.JupyterHub.cookie_max_age_days = 8
c = get_config()
c.Spawner.http_timeout = 120
c.BatchSpawnerBase.req_nprocs = '2'
c.BatchSpawnerBase.req_partition = 'short'
c.BatchSpawnerBase.req_keepvars_extra = 'LD_LIBRARY_PATH'
c.JupyterHub.spawner_class = 'wrapspawner.ProfilesSpawner'
c.ProfilesSpawner.profiles = [
('2 cores, 4 GB, 8 hours', '4gb', 'batchspawner.SlurmSpawner',
dict(req_runtime='8:00:00', req_memory='4gb')),
('2 cores, 128 GB, 4 hours', '128gb', 'batchspawner.SlurmSpawner',
dict(req_runtime='4:00:00', req_memory='128gb')),
]
This is what is printed in stdout.
[W 2019-08-30 07:37:45.244 JupyterHub configurable:168] Config option `req_keepvars_extra` not recognized by `SlurmSpawner`.
[I 2019-08-30 07:37:45.258 JupyterHub batchspawner:178] keepvars: PATH,LANG,JUPYTERHUB_API_TOKEN,JPY_API_TOKEN,JUPYTERHUB_CLIENT_ID,JUPYTERHUB_HOST,JUPYTERHUB_OAUTH_CALLBACK_URL,JUPYTERHUB_USER,JUPYTERHUB_SERVER_NAME,JUPYTERHUB_API_URL,JUPYTERHUB_ACTIVITY_URL,JUPYTERHUB_BASE_URL,JUPYTERHUB_SERVICE_PREFIX,USER,HOME,SHELL
[I 2019-08-30 07:37:45.258 JupyterHub batchspawner:179] keepvars_extra:
[I 2019-08-30 07:37:45.262 JupyterHub batchspawner:250] Spawner submitting job using sudo -E -u omula sbatch --parsable
I am using ProfileSpawner with batchspawner and I managed to have it working. However, there's something which I don't fully understand. As I have seen in the examples I have defined variables at the top level for the partition and nprocs while defined amount of RAM and time in each profile.
I have tried to set the req_keepvars_extra at the top level as I want it for all the profiles. Nonetheless, it only works if I set it in the profile. In the example below only the first profile works.
Is there any way to set req_keepvars_extra globally?
Thanks for you help.