def generic_index(request, **kwds): """ Generic interface to the various index views allowing us to specify optional constraints to blackboard entry selection. Valid constraints are dataset=... and owner=... (apart from no constraint). """ valid_keys = set(('dataset', 'owner')) keys = set(kwds.keys()) assert(keys.issubset(valid_keys)) # Load the template. t = loader.get_template('monitor/index.html') # Get the bb entries. entries = blackboard.listEntries(**kwds) # Decorate them with extra attributes. for e in entries: submit_host = e.GlobalJobId[:e.GlobalJobId.find('#')] e.RequestId = '%s@%s' % (quote(str(e.DAGManJobId)), submit_host) # Render the template and exit. c = Context({'entries': entries, }) return(HttpResponse(t.render(c)))
def owlapi_jobs_get_list(self, owner=None, dataset=None, offset=None, limit=20, newest_first=True): """ Return the list of all Blackboard entries, optionally restricting to those corresponding to a given dataset (when `dataset` is not None) and/or a given user (when `owner` is not None). Pagination is performed using `limit` and `offset` (and is disabled by default). `offset` can be either None (default) or a positive integer. If `offset` is 0 or None (or anything but a positive integer), return results starting from index 0, otherwise form index `offset`. `limit` can be either None (default=20) or a positive integer. If `limit` is None (or anything but a positive integer), return all the entries to the end of the list (and from `offset`). Otherwise return at most `limit` results (again starting from `offset`). If newest_first=True, then the results are sorted by descending JobStartDate. The sorting is reversed otherwise. Usage jobs_get_list(owner=None, datasset=None, offset=None, limit=20, newest_first=True) Return [{GlobalJobId, DAGManJobId, Dataset, Owner, JobStartDate, DAGNodeName, DAGParentNodeNames, ExitCode, JobState, JobDuration}] """ fields = ('GlobalJobId', 'DAGManJobId', 'Dataset', 'Owner', 'JobStartDate', 'DAGNodeName', 'DAGParentNodeNames', 'ExitCode', 'JobState', 'JobDuration') # Do we have a limit on the number of rows we can return? if(self._max_rows and self._max_rows < limit): limit = self._max_rows return([dict([(f, getattr(e, f, None)) for f in fields]) \ for e in blackboard.listEntries(owner=owner, dataset=dataset, limit=limit, offset=offset, newest_first=newest_first)])
def owlapi_jobs_get_list(self, owner=None, dataset=None, offset=None, limit=20, newest_first=True): """ Return the list of all Blackboard entries, optionally restricting to those corresponding to a given dataset (when `dataset` is not None) and/or a given user (when `owner` is not None). Pagination is performed using `limit` and `offset` (and is disabled by default). `offset` can be either None (default) or a positive integer. If `offset` is 0 or None (or anything but a positive integer), return results starting from index 0, otherwise form index `offset`. `limit` can be either None (default=20) or a positive integer. If `limit` is None (or anything but a positive integer), return all the entries to the end of the list (and from `offset`). Otherwise return at most `limit` results (again starting from `offset`). If newest_first=True, then the results are sorted by descending JobStartDate. The sorting is reversed otherwise. Usage jobs_get_list(owner=None, datasset=None, offset=None, limit=20, newest_first=True) Return [{GlobalJobId, DAGManJobId, Dataset, Owner, JobStartDate, DAGNodeName, DAGParentNodeNames, ExitCode, JobState, JobDuration}] """ fields = ('GlobalJobId', 'DAGManJobId', 'Dataset', 'Owner', 'JobStartDate', 'DAGNodeName', 'DAGParentNodeNames', 'ExitCode', 'JobState', 'JobDuration') # Do we have a limit on the number of rows we can return? if (self._max_rows and self._max_rows < limit): limit = self._max_rows return([dict([(f, getattr(e, f, None)) for f in fields]) \ for e in blackboard.listEntries(owner=owner, dataset=dataset, limit=limit, offset=offset, newest_first=newest_first)])