예제 #1
0
    def _create_jobs(self):
        fixture = {
            'schedule_id': self.schedule_1['id'],
            'tenant_id': unit_test_utils.TENANT1,
            'worker_id': None,
            'action': 'snapshot',
            'status': None,
            'retry_count': 0,
        }
        self.job_1 = db_api.job_create(fixture)

        fixture = {
            'schedule_id': self.schedule_2['id'],
            'tenant_id': unit_test_utils.TENANT2,
            'worker_id': unit_test_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_2 = db_api.job_create(fixture)
예제 #2
0
    def _create_jobs(self):
        now = timeutils.utcnow()
        timeout = now + datetime.timedelta(hours=1)
        hard_timeout = now + datetime.timedelta(hours=4)

        fixture = {
            "id": unit_utils.JOB_UUID1,
            "schedule_id": self.schedule_1["id"],
            "tenant": unit_utils.TENANT1,
            "worker_id": None,
            "action": "snapshot",
            "status": None,
            "timeout": timeout,
            "hard_timeout": hard_timeout,
            "retry_count": 0,
        }
        self.job_1 = db_api.job_create(fixture)
        fixture = {
            "id": unit_utils.JOB_UUID2,
            "schedule_id": self.schedule_2["id"],
            "tenant": unit_utils.TENANT2,
            "worker_id": unit_utils.WORKER_UUID2,
            "action": "snapshot",
            "status": None,
            "timeout": timeout,
            "hard_timeout": hard_timeout,
            "retry_count": 1,
            "job_metadata": [{"key": "instance_id", "value": "my_instance"}],
        }
        self.job_2 = db_api.job_create(fixture)
        fixture = {
            "id": unit_utils.JOB_UUID3,
            "schedule_id": self.schedule_3["id"],
            "tenant": unit_utils.TENANT3,
            "worker_id": unit_utils.WORKER_UUID2,
            "action": "snapshot",
            "status": None,
            "timeout": timeout,
            "hard_timeout": hard_timeout,
            "retry_count": 1,
            "job_metadata": [{"key": "instance_id", "value": "my_instance"}],
        }
        self.job_3 = db_api.job_create(fixture)
        fixture = {
            "id": unit_utils.JOB_UUID4,
            "schedule_id": self.schedule_4["id"],
            "tenant": unit_utils.TENANT4,
            "worker_id": unit_utils.WORKER_UUID2,
            "action": "snapshot",
            "status": None,
            "timeout": timeout,
            "hard_timeout": hard_timeout,
            "retry_count": 1,
            "job_metadata": [{"key": "instance_id", "value": "my_instance"}],
        }
        self.job_4 = db_api.job_create(fixture)
예제 #3
0
 def _create_jobs_meta(self):
     fixture = {"id": unit_utils.JOB_UUID1, "tenant": unit_utils.TENANT1, "action": "snapshot"}
     self.job_1 = db_api.job_create(fixture)
     meta_fixture1 = {"key": "key1", "value": "value1"}
     self.meta_1 = db_api.job_meta_create(self.job_1["id"], meta_fixture1)
     meta_fixture2 = {"key": "key2", "value": "value2"}
     self.meta_2 = db_api.job_meta_create(self.job_1["id"], meta_fixture2)
예제 #4
0
파일: test_jobs.py 프로젝트: komawar/qonos
 def _create_jobs(self):
     fixture = {
         'tenant_id': unit_utils.TENANT1,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
         'next_run': '2012-11-27T02:30:00Z'
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'tenant_id': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
         'next_run': '2012-11-27T02:30:00Z',
         'schedule_metadata': [
             {
                 'key': 'instance_id',
                 'value': 'my_instance',
             },
         ],
     }
     self.schedule_2 = db_api.schedule_create(fixture)
     fixture = {
         'schedule_id': self.schedule_1['id'],
         'tenant_id': unit_utils.TENANT1,
         'worker_id': unit_utils.WORKER_UUID1,
         'action': 'snapshot',
         'status': 'queued',
         'retry_count': 0,
     }
     self.job_1 = db_api.job_create(fixture)
     fixture = {
         'schedule_id': self.schedule_2['id'],
         'tenant_id': unit_utils.TENANT2,
         'worker_id': unit_utils.WORKER_UUID2,
         'action': 'snapshot',
         'status': 'error',
         'retry_count': 1,
         'job_metadata': [
             {
                 'key': 'instance_id',
                 'value': 'my_instance',
             },
         ],
     }
     self.job_2 = db_api.job_create(fixture)
예제 #5
0
 def _create_jobs_meta(self):
     fixture = {
         'tenant_id': unit_utils.TENANT1,
         'action': 'snapshot',
     }
     self.job_1 = db_api.job_create(fixture)
     meta_fixture1 = {'key': 'key1', 'value': 'value1'}
     self.meta_1 = db_api.job_meta_create(self.job_1['id'], meta_fixture1)
     meta_fixture2 = {'key': 'key2', 'value': 'value2'}
     self.meta_2 = db_api.job_meta_create(self.job_1['id'], meta_fixture2)
예제 #6
0
파일: test_jobs.py 프로젝트: isethi/qonos
    def _create_jobs(self):
        fixture = {
            'id': unit_utils.SCHEDULE_UUID1,
            'tenant': unit_utils.TENANT1,
            'action': 'snapshot',
            'minute': '30',
            'hour': '2',
            'next_run': '2012-11-27T02:30:00Z'
        }
        self.schedule_1 = db_api.schedule_create(fixture)
        fixture = {
            'id': unit_utils.SCHEDULE_UUID2,
            'tenant': unit_utils.TENANT2,
            'action': 'snapshot',
            'minute': '30',
            'hour': '2',
            'next_run': '2012-11-27T02:30:00Z',
            'schedule_metadata': [
                    {
                    'key': 'instance_id',
                    'value': 'my_instance',
                    }
            ],
        }
        self.schedule_2 = db_api.schedule_create(fixture)

        now = timeutils.utcnow()
        timeout = now + datetime.timedelta(hours=1)
        hard_timeout = now + datetime.timedelta(hours=4)

        fixture = {
            'id': unit_utils.JOB_UUID1,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'queued',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_1 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID2,
            'schedule_id': self.schedule_2['id'],
            'tenant': unit_utils.TENANT2,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': 'error',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                    {
                    'key': 'instance_id',
                    'value': 'my_instance',
                    },
                ]
        }
        self.job_2 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID3,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'queued',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_3 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID4,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'queued',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_4 = db_api.job_create(fixture)
예제 #7
0
    def _create_jobs(self):
        now = timeutils.utcnow()
        timeout = now + datetime.timedelta(hours=1)
        hard_timeout = now + datetime.timedelta(hours=4)

        fixture = {
            'id': unit_utils.JOB_UUID1,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': None,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_1 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID2,
            'schedule_id': self.schedule_2['id'],
            'tenant': unit_utils.TENANT2,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_2 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID3,
            'schedule_id': self.schedule_3['id'],
            'tenant': unit_utils.TENANT3,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_3 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID4,
            'schedule_id': self.schedule_4['id'],
            'tenant': unit_utils.TENANT4,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_4 = db_api.job_create(fixture)
예제 #8
0
    def _create_jobs(self):
        next_run = timeutils.parse_isotime('2012-11-27T02:30:00Z').replace(
            tzinfo=None)
        fixture = {
            'id': unit_utils.SCHEDULE_UUID1,
            'tenant': unit_utils.TENANT1,
            'action': 'snapshot',
            'minute': '30',
            'hour': '2',
            'next_run': next_run,
        }
        self.schedule_1 = db_api.schedule_create(fixture)
        fixture = {
            'id':
            unit_utils.SCHEDULE_UUID2,
            'tenant':
            unit_utils.TENANT2,
            'action':
            'snapshot',
            'minute':
            '30',
            'hour':
            '2',
            'next_run':
            next_run,
            'schedule_metadata': [{
                'key': 'instance_id',
                'value': 'my_instance',
            }],
        }
        self.schedule_2 = db_api.schedule_create(fixture)

        now = timeutils.utcnow()
        timeout = now + datetime.timedelta(hours=1)
        hard_timeout = now + datetime.timedelta(hours=8)

        fixture = {
            'id': unit_utils.JOB_UUID1,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'QUEUED',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_1 = db_api.job_create(fixture)
        timeout = now + datetime.timedelta(hours=2)
        hard_timeout = now + datetime.timedelta(hours=4)
        fixture = {
            'id': unit_utils.JOB_UUID2,
            'schedule_id': self.schedule_2['id'],
            'tenant': unit_utils.TENANT2,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': 'ERROR',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ]
        }
        self.job_2 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID3,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT3,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'QUEUED',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_3 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID4,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'test_action',
            'status': 'QUEUED',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_4 = db_api.job_create(fixture)
예제 #9
0
파일: test_jobs.py 프로젝트: broble/qonos
    def _create_jobs(self):
        next_run = timeutils.parse_isotime('2012-11-27T02:30:00Z').\
                             replace(tzinfo=None)
        fixture = {
            'id': unit_utils.SCHEDULE_UUID1,
            'tenant': unit_utils.TENANT1,
            'action': 'snapshot',
            'minute': '30',
            'hour': '2',
            'next_run': next_run,
        }
        self.schedule_1 = db_api.schedule_create(fixture)
        fixture = {
            'id': unit_utils.SCHEDULE_UUID2,
            'tenant': unit_utils.TENANT2,
            'action': 'snapshot',
            'minute': '30',
            'hour': '2',
            'next_run': next_run,
            'schedule_metadata': [
                    {
                    'key': 'instance_id',
                    'value': 'my_instance',
                    }
            ],
        }
        self.schedule_2 = db_api.schedule_create(fixture)

        now = timeutils.utcnow()
        timeout = now + datetime.timedelta(hours=1)
        hard_timeout = now + datetime.timedelta(hours=8)

        fixture = {
            'id': unit_utils.JOB_UUID1,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'QUEUED',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_1 = db_api.job_create(fixture)
        timeout = now + datetime.timedelta(hours=2)
        hard_timeout = now + datetime.timedelta(hours=4)
        fixture = {
            'id': unit_utils.JOB_UUID2,
            'schedule_id': self.schedule_2['id'],
            'tenant': unit_utils.TENANT2,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': 'ERROR',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                    {
                    'key': 'instance_id',
                    'value': 'my_instance',
                    },
                ]
        }
        self.job_2 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID3,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT3,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'snapshot',
            'status': 'QUEUED',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_3 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID4,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': unit_utils.WORKER_UUID1,
            'action': 'test_action',
            'status': 'QUEUED',
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_4 = db_api.job_create(fixture)
예제 #10
0
    def _create_jobs(self):
        now = timeutils.utcnow()
        timeout = now + datetime.timedelta(hours=1)
        hard_timeout = now + datetime.timedelta(hours=4)

        fixture = {
            'id': unit_utils.JOB_UUID1,
            'schedule_id': self.schedule_1['id'],
            'tenant': unit_utils.TENANT1,
            'worker_id': None,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 0,
        }
        self.job_1 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID2,
            'schedule_id': self.schedule_2['id'],
            'tenant': unit_utils.TENANT2,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_2 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID3,
            'schedule_id': self.schedule_3['id'],
            'tenant': unit_utils.TENANT3,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_3 = db_api.job_create(fixture)
        fixture = {
            'id': unit_utils.JOB_UUID4,
            'schedule_id': self.schedule_4['id'],
            'tenant': unit_utils.TENANT4,
            'worker_id': unit_utils.WORKER_UUID2,
            'action': 'snapshot',
            'status': None,
            'timeout': timeout,
            'hard_timeout': hard_timeout,
            'retry_count': 1,
            'job_metadata': [
                {
                    'key': 'instance_id',
                    'value': 'my_instance',
                },
            ],
        }
        self.job_4 = db_api.job_create(fixture)