MCPcopy
hub / github.com/hyperopt/hyperopt / count_by_state_unsynced

Method count_by_state_unsynced

hyperopt/mongoexp.py:845–860  ·  view source on GitHub ↗
(self, arg)

Source from the content-addressed store, hash-verified

843 return rval
844
845 def count_by_state_unsynced(self, arg):
846 exp_key = self._exp_key
847 # TODO: consider searching by SON rather than dict
848 if isinstance(arg, int):
849 if arg not in JOB_STATES:
850 raise ValueError("invalid state", arg)
851 query = dict(state=arg)
852 else:
853 assert hasattr(arg, "__iter__")
854 states = list(arg)
855 assert all([x in JOB_STATES for x in states])
856 query = dict(state={"$in": states})
857 if exp_key != None:
858 query["exp_key"] = exp_key
859 rval = self.handle.jobs.find(query).count()
860 return rval
861
862 def delete_all(self, cond=None):
863 cond = {} if cond is None else dict(cond)

Callers 1

test_trial_attachmentsFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_trial_attachmentsFunction · 0.76