def getjobs(self, path = None): """Gives list of all jobs (objects) referenced in current folder or folder in the path if the latter is provided. """ #jobslice ##res = [] res = JobRegistrySlice("") registry = self._getRegistry() do_clean = False if registry is not None: registry = registry._parent path = os.path.join(*self.__get_path(path)) res.name = "jobs found in %s" % path cont = self.ls(path) for i in cont['jobs']: try: try: id = int(i) j = registry[id] except ValueError: j = registry[int(i.split('.')[0])].subjobs[int(i.split('.')[1])] except RegistryKeyError: do_clean = True else: res.objects[j.id] = j if do_clean: self.cleanlinks() return _wrap(res)
res.name = "jobs found in %s" % path cont = self.ls(path) for i in cont['jobs']: try: try: id = int(i) j = registry[id] except ValueError: j = registry[int(i.split('.')[0])].subjobs[int(i.split('.')[1])] except RegistryKeyError, ObjectNotInRegistryError: do_clean = True else: res.objects[j.id] = j if do_clean: self.cleanlinks() return _wrap(res) def find(self, id, path=None): """For a job with given id tries to find all references in the job tree. The return value is a list of found paths. """ if isType(id, Job): id = stripProxy(id).getFQID('.') if isType(id, GPIProxyObject): id = stripProxy(id) pp = self.__get_path(path) tp = os.path.join(*pp) top_level = self.__folder_cd(pp)
cont = self.ls(path) for i in cont['jobs']: try: try: id = int(i) j = registry[id] except ValueError: j = registry[int(i.split('.')[0])].subjobs[int( i.split('.')[1])] except RegistryKeyError, ObjectNotInRegistryError: do_clean = True else: res.objects[j.id] = j if do_clean: self.cleanlinks() return _wrap(res) def find(self, id, path=None): """For a job with given id tries to find all references in the job tree. The return value is a list of found paths. """ if isType(id, Job): id = stripProxy(id).getFQID('.') if isType(id, GPIProxyObject): id = stripProxy(id) pp = self.__get_path(path) tp = os.path.join(*pp) top_level = self.__folder_cd(pp)