disco.util – Helper functions¶
This module provides utility functions that are mostly used by Disco internally.
- disco.util.jobname(url)¶
Extracts the job name from url.
This function is particularly useful for using the methods in disco.core.Disco given only the results of a job. A typical case is that you no longer need the results. You can tell Disco to delete the unneeded data as follows:
from disco.core import Disco from disco.util import jobname Disco().purge(jobname(results[0]))
- disco.util.kvgroup(kviter)¶
Group the values of consecutive keys which compare equal.
Takes an iterator over k, v pairs, and returns an iterator over k, vs. Does not sort the input first.
- disco.util.parse_dir(dir, label=None)¶
Translates a directory URL (dir://...) to a list of normal URLs.
This function might be useful for other programs that need to parse results returned by disco.core.Disco.wait(), for instance.
Parameters: dir – a directory url, such as dir://nx02/test_simple@12243344