def _create_schedules(self):
     fixture = {
         'id':
         unit_utils.SCHEDULE_UUID1,
         'tenant':
         unit_utils.TENANT1,
         'action':
         'snapshot',
         'minute':
         '30',
         'hour':
         '2',
         'schedule_metadata': [{
             'key': 'key1',
             'value': 'value1'
         }, {
             'key': 'key2',
             'value': 'value2'
         }]
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID2,
         'tenant': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
     }
     self.schedule_2 = db_api.schedule_create(fixture)
Exemple #2
0
 def _create_schedules(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)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID3,
         'tenant': unit_utils.TENANT3,
         'action': 'snapshot',
         'minute': '30',
         'hour': '4',
         'next_run': '2012-11-27T02:30:00Z',
     }
     self.schedule_3 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID4,
         'tenant': unit_utils.TENANT4,
         'action': 'snapshot',
         'minute': '30',
         'hour': '5',
         'next_run': '2012-11-27T02:30:00Z',
     }
     self.schedule_4 = db_api.schedule_create(fixture)
 def _create_schedules(self):
     fixture = {
         'tenant_id': unit_utils.TENANT1,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'tenant_id': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
     }
     self.schedule_2 = db_api.schedule_create(fixture)
Exemple #4
0
 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)
Exemple #5
0
 def _create_schedules(self):
     fixture = {
         'tenant_id': unit_utils.TENANT1,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 2)
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'tenant_id': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '3',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 3)
     }
     self.schedule_2 = db_api.schedule_create(fixture)
 def _create_schedules(self):
     fixture = {
         "id": unit_utils.SCHEDULE_UUID1,
         "tenant": unit_utils.TENANT1,
         "action": "snapshot",
         "minute": "30",
         "hour": "2",
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         "id": unit_utils.SCHEDULE_UUID2,
         "tenant": unit_utils.TENANT2,
         "action": "snapshot",
         "minute": "30",
         "hour": "2",
     }
     self.schedule_2 = db_api.schedule_create(fixture)
 def _create_schedules(self):
     fixture = {
         'id': unit_utils.SCHEDULE_UUID1,
         'tenant': unit_utils.TENANT1,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
         'schedule_metadata': [{'key': 'key1', 'value': 'value1'},
                               {'key': 'key2', 'value': 'value2'}]
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID2,
         'tenant': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
     }
     self.schedule_2 = db_api.schedule_create(fixture)
Exemple #8
0
 def _create_schedules(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)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID3,
         'tenant': unit_utils.TENANT3,
         'action': 'snapshot',
         'minute': '30',
         'hour': '4',
         'next_run': '2012-11-27T02:30:00Z',
     }
     self.schedule_3 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID4,
         'tenant': unit_utils.TENANT4,
         'action': 'snapshot',
         'minute': '30',
         'hour': '5',
         'next_run': '2012-11-27T02:30:00Z',
     }
     self.schedule_4 = db_api.schedule_create(fixture)
Exemple #9
0
 def _create_schedules(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)
     fixture = {
         "id": unit_utils.SCHEDULE_UUID3,
         "tenant": unit_utils.TENANT3,
         "action": "snapshot",
         "minute": "30",
         "hour": "4",
         "next_run": "2012-11-27T02:30:00Z",
     }
     self.schedule_3 = db_api.schedule_create(fixture)
     fixture = {
         "id": unit_utils.SCHEDULE_UUID4,
         "tenant": unit_utils.TENANT4,
         "action": "snapshot",
         "minute": "30",
         "hour": "5",
         "next_run": "2012-11-27T02:30:00Z",
     }
     self.schedule_4 = db_api.schedule_create(fixture)
Exemple #10
0
 def _create_schedules(self):
     fixture = {
         'id': unit_utils.SCHEDULE_UUID1,
         'tenant': unit_utils.TENANT1,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 2)
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID2,
         'tenant': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '3',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 3)
     }
     self.schedule_2 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID3,
         'tenant': unit_utils.TENANT3,
         'action': 'snapshot',
         'minute': '30',
         'hour': '4',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 4)
     }
     self.schedule_3 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID4,
         'tenant': unit_utils.TENANT4,
         'action': 'other',
         'minute': '30',
         'hour': '5',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 5)
     }
     self.schedule_4 = db_api.schedule_create(fixture)
Exemple #11
0
 def _create_schedules(self):
     fixture = {
         "id": unit_utils.SCHEDULE_UUID1,
         "tenant": unit_utils.TENANT1,
         "action": "snapshot",
         "minute": "30",
         "hour": "2",
         "next_run": qonos_utils.cron_string_to_next_datetime(30, 2),
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         "id": unit_utils.SCHEDULE_UUID2,
         "tenant": unit_utils.TENANT2,
         "action": "snapshot",
         "minute": "30",
         "hour": "3",
         "next_run": qonos_utils.cron_string_to_next_datetime(30, 3),
     }
     self.schedule_2 = db_api.schedule_create(fixture)
     fixture = {
         "id": unit_utils.SCHEDULE_UUID3,
         "tenant": unit_utils.TENANT3,
         "action": "snapshot",
         "minute": "30",
         "hour": "4",
         "next_run": qonos_utils.cron_string_to_next_datetime(30, 4),
     }
     self.schedule_3 = db_api.schedule_create(fixture)
     fixture = {
         "id": unit_utils.SCHEDULE_UUID4,
         "tenant": unit_utils.TENANT4,
         "action": "other",
         "minute": "30",
         "hour": "5",
         "next_run": qonos_utils.cron_string_to_next_datetime(30, 5),
     }
     self.schedule_4 = db_api.schedule_create(fixture)
Exemple #12
0
 def _create_schedules(self):
     fixture = {
         'id': unit_utils.SCHEDULE_UUID1,
         'tenant': unit_utils.TENANT1,
         'action': 'snapshot',
         'minute': '30',
         'hour': '2',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 2)
     }
     self.schedule_1 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID2,
         'tenant': unit_utils.TENANT2,
         'action': 'snapshot',
         'minute': '30',
         'hour': '3',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 3)
     }
     self.schedule_2 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID3,
         'tenant': unit_utils.TENANT3,
         'action': 'snapshot',
         'minute': '30',
         'hour': '4',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 4)
     }
     self.schedule_3 = db_api.schedule_create(fixture)
     fixture = {
         'id': unit_utils.SCHEDULE_UUID4,
         'tenant': unit_utils.TENANT4,
         'action': 'other',
         'minute': '30',
         'hour': '5',
         'next_run': qonos_utils.cron_string_to_next_datetime(30, 5)
     }
     self.schedule_4 = db_api.schedule_create(fixture)
Exemple #13
0
    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)
Exemple #14
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)
Exemple #15
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)