示例#1
0
文件: model.py 项目: fnaval/Rift
def get_job(job_id):
    db_handler = get_handler()
    job_dict = db_handler.get_document(
        object_name=JOB_COLLECTION,
        query_filter={"job_id": job_id})

    return build_job_from_dict(job_dict)
示例#2
0
文件: model.py 项目: fnaval/Rift
def get_jobs(tenant_id):
    db_handler = get_handler()
    jobs_dict = db_handler.get_documents(
        object_name=JOB_COLLECTION,
        query_filter={"tenant_id": tenant_id})

    return [build_job_from_dict(job) for job in jobs_dict]
示例#3
0
文件: job.py 项目: pglass/Rift
 def update_job(cls, job, handler=None):
     db_handler = handler or get_handler()
     db_handler.update_document(
         object_name=JOB_COLLECTION,
         document=job.as_dict(),
         query_filter={"id": job.id}
     )
示例#4
0
文件: model.py 项目: fnaval/Rift
def update_job(job):
    db_handler = get_handler()
    db_handler.update_document(
        object_name=JOB_COLLECTION,
        document=job.as_dict(),
        query_filter={"job_id": job.job_id}
    )
示例#5
0
文件: job.py 项目: pglass/Rift
    def get_job(cls, job_id, handler=None):
        db_handler = handler or get_handler()
        job_dict = db_handler.get_document(
            object_name=JOB_COLLECTION,
            query_filter={"id": job_id})

        return Job.build_job_from_dict(job_dict)
示例#6
0
 def get_schedules(cls, tenant_id):
     db_handler = get_handler()
     schedules_dict = db_handler.get_documents(
         object_name=SCHEDULE_COLLECTION,
         query_filter={"tenant_id": tenant_id})
     return [cls.build_schedule_from_dict(tenant_id, schedule)
             for schedule in schedules_dict]
示例#7
0
文件: job.py 项目: pglass/Rift
    def get_jobs(cls, tenant_id, handler=None):
        db_handler = handler or get_handler()
        jobs_dict = db_handler.get_documents(
            object_name=JOB_COLLECTION,
            query_filter={"tenant_id": tenant_id})

        return [Job.build_job_from_dict(job) for job in jobs_dict]
示例#8
0
    def get_job(cls, run_number, handler=None):
        db_handler = handler or get_handler()
        job_dict = db_handler.get_document(
            object_name=JOB_RUN_COLLECTION,
            query_filter={"run_number": run_number})

        return JobExecution.build_job_from_dict(job_dict)
示例#9
0
    def save_schedule(cls, schedule):
        db_dict = schedule.as_dict()
        db_dict['tenant_id'] = schedule.tenant_id

        db_handler = get_handler()
        db_handler.insert_document(object_name=SCHEDULE_COLLECTION,
                                   document=db_dict)
示例#10
0
文件: tenant.py 项目: CloudRift/Rift
 def update_tenant(cls, tenant):
     db_handler = get_handler()
     db_handler.update_document(
         object_name=TENANT_COLLECTION,
         document=tenant.as_dict(),
         query_filter={"tenant_id": tenant.tenant_id}
     )
示例#11
0
    def save_job(cls, job, handler=None):
        job_dict = job.as_dict()
        job_dict['tenant_id'] = job.tenant_id

        db_handler = handler or get_handler()
        db_handler.insert_document(object_name=JOB_COLLECTION,
                                   document=job_dict)
示例#12
0
    def save_schedule(cls, schedule):
        db_dict = schedule.as_dict()
        db_dict['tenant_id'] = schedule.tenant_id

        db_handler = get_handler()
        db_handler.insert_document(
            object_name=SCHEDULE_COLLECTION, document=db_dict
        )
示例#13
0
文件: job.py 项目: pglass/Rift
    def save_job(cls, job, handler=None):
        job_dict = job.as_dict()
        job_dict['tenant_id'] = job.tenant_id

        db_handler = handler or get_handler()
        db_handler.insert_document(
            object_name=JOB_COLLECTION, document=job_dict
        )
示例#14
0
 def get_schedules(cls, tenant_id):
     db_handler = get_handler()
     schedules_dict = db_handler.get_documents(
         object_name=SCHEDULE_COLLECTION,
         query_filter={"tenant_id": tenant_id})
     return [
         cls.build_schedule_from_dict(tenant_id, schedule)
         for schedule in schedules_dict
     ]
示例#15
0
    def get_target(cls, tenant_id, target_id):
        db_handler = get_handler()
        target_dict = db_handler.get_document(
            object_name=TARGET_COLLECTION,
            query_filter={"$or": [{"id": target_id}, {"name": target_id}]})

        target_dict = Target.decrypt_auth_data(target_dict)

        return Target.build_target_from_dict(tenant_id, target_dict)
示例#16
0
    def save_target(cls, target):
        db_dict = target.as_dict()
        db_dict['tenant_id'] = target.tenant_id

        # Make sure we encrypt the auth data
        db_dict = Target.encrypt_auth_data(db_dict)

        db_handler = get_handler()
        db_handler.insert_document(
            object_name=TARGET_COLLECTION, document=db_dict
        )
示例#17
0
    def get_targets(cls, tenant_id):
        db_handler = get_handler()
        targets_dict = db_handler.get_documents(
            object_name=TARGET_COLLECTION,
            query_filter={"tenant_id": tenant_id})

        # Make sure and decrypt the auth data
        targets = [Target.decrypt_auth_data(target) for target in targets_dict]

        return [Target.build_target_from_dict(tenant_id, target)
                for target in targets]
示例#18
0
文件: tenant.py 项目: CloudRift/Rift
    def get_tenant(cls, tenant_id):
        db_handler = get_handler()
        tenant_dict = db_handler.get_document(
            object_name=TENANT_COLLECTION,
            query_filter={"tenant_id": tenant_id})

        # Create Tenant if it doesn't exist
        if not tenant_dict:
            LOG.info('Tenant {0} not found. Creating...'.format(tenant_id))
            tenant = cls(tenant_id)
            cls.save_tenant(tenant)
        else:
            tenant = Tenant.build_tenant_from_dict(tenant_dict)

        return tenant
示例#19
0
    def get_tenant(cls, tenant_id):
        db_handler = get_handler()
        tenant_dict = db_handler.get_document(
            object_name=TENANT_COLLECTION,
            query_filter={"tenant_id": tenant_id})

        # Create Tenant if it doesn't exist
        if not tenant_dict:
            LOG.info('Tenant {0} not found. Creating...'.format(tenant_id))
            tenant = cls(tenant_id)
            cls.save_tenant(tenant)
        else:
            tenant = Tenant.build_tenant_from_dict(tenant_dict)

        return tenant
示例#20
0
文件: tenant.py 项目: CloudRift/Rift
 def save_tenant(cls, tenant):
     db_handler = get_handler()
     db_handler.insert_document(
         object_name=TENANT_COLLECTION, document=tenant.as_dict()
     )
示例#21
0
 def delete_schedule(cls, schedule_id):
     db_handler = get_handler()
     db_handler.delete_document(object_name=SCHEDULE_COLLECTION,
                                query_filter={"id": schedule_id})
示例#22
0
 def delete_job(cls, run_number, handler=None):
     db_handler = handler or get_handler()
     db_handler.delete_document(object_name=JOB_RUN_COLLECTION,
                                query_filter={"run_number": run_number})
示例#23
0
 def update_job(cls, job, handler=None):
     db_handler = handler or get_handler()
     db_handler.update_document(object_name=JOB_COLLECTION,
                                document=job.as_dict(),
                                query_filter={"id": job.id})
示例#24
0
 def update_tenant(cls, tenant):
     db_handler = get_handler()
     db_handler.update_document(
         object_name=TENANT_COLLECTION,
         document=tenant.as_dict(),
         query_filter={"tenant_id": tenant.tenant_id})
示例#25
0
 def save_tenant(cls, tenant):
     db_handler = get_handler()
     db_handler.insert_document(object_name=TENANT_COLLECTION,
                                document=tenant.as_dict())
示例#26
0
 def get_schedule(cls, tenant_id, schedule_id):
     db_handler = get_handler()
     schedule_dict = db_handler.get_document(
         object_name=SCHEDULE_COLLECTION,
         query_filter={"id": schedule_id})
     return cls.build_schedule_from_dict(tenant_id, schedule_dict)
示例#27
0
 def delete_schedule(cls, schedule_id):
     db_handler = get_handler()
     db_handler.delete_document(
         object_name=SCHEDULE_COLLECTION,
         query_filter={"id": schedule_id})
示例#28
0
文件: model.py 项目: fnaval/Rift
def delete_job(job_id):
    db_handler = get_handler()
    db_handler.delete_document(
        object_name=JOB_COLLECTION,
        query_filter={"job_id": job_id}
    )
示例#29
0
def get_job(job_id):
    db_handler = get_handler()
    job_dict = db_handler.get_document(object_name=JOB_COLLECTION,
                                       query_filter={"job_id": job_id})

    return build_job_from_dict(job_dict)
示例#30
0
    def get_jobs(cls, tenant_id, handler=None):
        db_handler = handler or get_handler()
        jobs_dict = db_handler.get_documents(
            object_name=JOB_COLLECTION, query_filter={"tenant_id": tenant_id})

        return [Job.build_job_from_dict(job) for job in jobs_dict]
示例#31
0
 def delete_target(cls, target_id, handler=None):
     db_handler = handler or get_handler()
     db_handler.delete_document(
         object_name=TARGET_COLLECTION,
         query_filter={"id": target_id}
     )
示例#32
0
def save_job(job):
    db_handler = get_handler()
    db_handler.insert_document(object_name=JOB_COLLECTION,
                               document=job.as_dict())
示例#33
0
 def delete_job(cls, run_number, handler=None):
     db_handler = handler or get_handler()
     db_handler.delete_document(object_name=JOB_RUN_COLLECTION, query_filter={"run_number": run_number})
示例#34
0
文件: job.py 项目: pglass/Rift
 def delete_job(cls, job_id, handler=None):
     db_handler = handler or get_handler()
     db_handler.delete_document(
         object_name=JOB_COLLECTION,
         query_filter={"id": job_id}
     )
示例#35
0
    def get_job(cls, run_number, handler=None):
        db_handler = handler or get_handler()
        job_dict = db_handler.get_document(object_name=JOB_RUN_COLLECTION, query_filter={"run_number": run_number})

        return JobExecution.build_job_from_dict(job_dict)
示例#36
0
def delete_job(job_id):
    db_handler = get_handler()
    db_handler.delete_document(object_name=JOB_COLLECTION,
                               query_filter={"job_id": job_id})
示例#37
0
 def get_schedule(cls, tenant_id, schedule_id):
     db_handler = get_handler()
     schedule_dict = db_handler.get_document(
         object_name=SCHEDULE_COLLECTION, query_filter={"id": schedule_id})
     return cls.build_schedule_from_dict(tenant_id, schedule_dict)
示例#38
0
    def get_job(cls, job_id, handler=None):
        db_handler = handler or get_handler()
        job_dict = db_handler.get_document(object_name=JOB_COLLECTION,
                                           query_filter={"id": job_id})

        return Job.build_job_from_dict(job_dict)
示例#39
0
文件: model.py 项目: fnaval/Rift
def save_job(job):
    db_handler = get_handler()
    db_handler.insert_document(
        object_name=JOB_COLLECTION, document=job.as_dict()
    )
示例#40
0
 def delete_job(cls, job_id, handler=None):
     db_handler = handler or get_handler()
     db_handler.delete_document(object_name=JOB_COLLECTION,
                                query_filter={"id": job_id})
示例#41
0
def update_job(job):
    db_handler = get_handler()
    db_handler.update_document(object_name=JOB_COLLECTION,
                               document=job.as_dict(),
                               query_filter={"job_id": job.job_id})