Beispiel #1
0
    def get_all(self):
        LOG.info("Get all %ss.", self.type)

        jobs = [
            resources.Job.from_dict(db_model.to_dict())
            for db_model in db_api.get_jobs()
        ]

        return resources.Jobs(jobs=jobs)
Beispiel #2
0
    def get_all(self, all_projects=False, project_id=None):
        project_id, all_projects = rest_utils.get_project_params(
            project_id, all_projects)
        if all_projects:
            acl.enforce('job:get_all:all_projects', context.get_ctx())

        filters = rest_utils.get_filters(project_id=project_id, )
        LOG.info("Get all %ss. filters=%s", self.type, filters)
        db_jobs = db_api.get_jobs(insecure=all_projects, **filters)
        jobs = [resources.Job.from_db_obj(db_model) for db_model in db_jobs]

        return resources.Jobs(jobs=jobs)