(self, arg)
| 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) |
no outgoing calls