Skip to content
Snippets Groups Projects

If not given in notebook.py get default concurrency parameter from jupyter notebook

Merged Mikhail Karnevskiy requested to merge defaultParameters into master
1 unresolved thread

Concurrency parameter is expected to be given from the command line. If it is not given, it is taken from notebook.py. If concurrency parameter there is None, it will be taken from jupyter notebook.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
421 421 defcval = concurrency.get("default concurrency", None)
422 if not isinstance(defcval, (list, tuple)):
423 cvals = range(defcval)
422 if defcval is not None:
423 print("Concurrency parameter '{}' is taken from notebooks.py".format(cvar))
424 if not isinstance(defcval, (list, tuple)):
425 cvals = range(defcval)
426 else:
427 cvals = defcval
424 428 else:
425 cvals = defcval
426
429 for p in parms:
430 if p.name == cvar:
431 cvals = p.value
432 print("Concurrency parameter '{}' is taken from '{}'".format(cvar, notebook))
  • You will need to do the same check for list and tuples here, to allow handling of scalar values in the notebook

  • Author Contributor

    Indeed. If the value is a scalar, it have to be concerted to list. I would imagine something like: cvals = [defcval] In case of range function: cvals = range(defcval) if defcval is e.g. 1000 cvals would be a list of 1000 elements and 1000 jobs will be submitter. I guess it not what should be. Is there a reason, why range function is used for default parameter from notebooks.py?

  • I don’t think we should be overly smart here in guessing the defaults. The rabge(16) expressions come from the number of modules on those detectors. I would not conclude however that for a scalar given in a notebook we should also default to range(that scalar). Rather, simply wrap the scalar in a list and add a note to the documentation, that this is the default behavior, if no defaults are specified in notebook.py

  • Author Contributor

    Check of default coming from notebook.py is still as in master. Default coming from jupyter notebook is wrapped in a list if needed.

  • Please register or sign in to reply
  • added 2 commits

    • 6a0b4c2c - Add check of the type of given concurrency parameter. Convert to a list if needed.
    • 4135b27f - Fix access to concurrency parameter

    Compare with previous version

  • merged

  • Steffen Hauf mentioned in commit a2423bb8

    mentioned in commit a2423bb8

  • Please register or sign in to reply
    Loading