Exemple #1
0
def test_reconcile_tasks(mocker):
    ID = str(uuid.uuid4())
    sched = mocker.Mock()
    framework = {'id': {'value': ID}}
    master = mocker.Mock()
    driver = MesosSchedulerDriver(sched, framework, master)
    driver._send = mocker.Mock()
    task_ids = [str(uuid.uuid4()) for _ in range(random.randint(1, 10))]
    tasks = [
        {
            'task_id': {
                'value': id
            }
        }
        for id in task_ids
    ]
    driver.reconcileTasks(tasks)
    driver._send.assert_called_once_with({
        'type': 'RECONCILE',
        'framework_id': {
            'value': ID
        },
        'reconcile': {
            'tasks': tasks
        }
    })
Exemple #2
0
    def registered(self, driver: MesosSchedulerDriver, frameworkId, masterInfo):
        self.framework_id = frameworkId['value']
        self.log("Registered with framework ID %s" % frameworkId['value'])

        self.task_store = self.task_store_type(
            service_name=self.service_name,
            instance_name=self.instance_name,
            framework_id=self.framework_id,
            system_paasta_config=self.system_paasta_config,
        )

        self.reconcile_start_time = time.time()
        driver.reconcileTasks([])