Esempio n. 1
0
 def test_from_json(self):
     schedule_config = WorkflowScheduleConfig.from_json(WorkflowScheduleConfigTestCase._SCHEDULE_JSON)
     self.assertEqual(["*****@*****.**", "*****@*****.**"], schedule_config.emails)
     self.assertEqual("DELAY", schedule_config.overrun_policy)
     self.assertEqual("1d", schedule_config.recurrence)
     self.assertEqual("2012-01-01", schedule_config.start_date)
     self.assertEqual("00.00.01.000", schedule_config.time)
     self.assertEqual("some_workflow", schedule_config.workflow)
Esempio n. 2
0
 def test_put_schedule(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         _SCHEDULE_TEMPLATE % '1w')
     self._repository.put_schedule(schedule_config)
     self.assertEqual(1, len(self._repository.configs))
     self.assertEqual(
         _SCHEDULE_TEMPLATE % '1w',
         self._repository.configs['/workflow/some_workflow/schedule'])
Esempio n. 3
0
 def test_put_schedule(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         _SCHEDULE_TEMPLATE % '1w')
     self._repository.put_schedule(schedule_config)
     self.assertEqual(1, len(self._repository.configs))
     self.assertEqual(
         _SCHEDULE_TEMPLATE % '1w',
         self._repository.configs['/workflow/some_workflow/schedule'])
Esempio n. 4
0
 def test_format(self):
     schedule_config = WorkflowScheduleConfig.from_json(WorkflowScheduleConfigTestCase._SCHEDULE_JSON)
     formatted_config = schedule_config.format()
     self.assertEqual(["*****@*****.**", "*****@*****.**"], formatted_config["emails"])
     self.assertEqual("DELAY", formatted_config["overrun_policy"])
     self.assertEqual("1d", formatted_config["recurrence"])
     self.assertEqual("2012-01-01", formatted_config["start_date"])
     self.assertEqual("00.00.01.000", formatted_config["time"])
     self.assertEqual("some_workflow", formatted_config["workflow"])
Esempio n. 5
0
 def test_from_json(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         WorkflowScheduleConfigTestCase._SCHEDULE_JSON)
     self.assertEqual(['*****@*****.**',
                       '*****@*****.**'],
                      schedule_config.emails)
     self.assertEqual('DELAY', schedule_config.overrun_policy)
     self.assertEqual('1d', schedule_config.recurrence)
     self.assertEqual('2012-01-01', schedule_config.start_date)
     self.assertEqual('00.00.01.000', schedule_config.time)
     self.assertEqual('some_workflow', schedule_config.workflow)
Esempio n. 6
0
 def test_from_json(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         WorkflowScheduleConfigTestCase._SCHEDULE_JSON)
     self.assertEqual(['*****@*****.**',
                       '*****@*****.**'],
                      schedule_config.emails)
     self.assertEqual('DELAY', schedule_config.overrun_policy)
     self.assertEqual('1d', schedule_config.recurrence)
     self.assertEqual('2012-01-01', schedule_config.start_date)
     self.assertEqual('00.00.01.000', schedule_config.time)
     self.assertEqual('some_workflow', schedule_config.workflow)
Esempio n. 7
0
    def get_schedule(self, workflow):
        """Retrieve schedule config for a given workflow.

        Args:
            workflow: The workflow name whose schedule should be retrieved.
        Returns:
            The schedule config.
        """
        path = Path(workflow=workflow)
        schedule_json = self._get_config(path.get_schedule_path())
        return WorkflowScheduleConfig.from_json(schedule_json)
Esempio n. 8
0
    def get_schedule(self, workflow):
        """Retrieve schedule config for a given workflow.

        Args:
            workflow: The workflow name whose schedule should be retrieved.
        Returns:
            The schedule config.
        """
        path = Path(workflow=workflow)
        schedule_json = self._get_config(path.get_schedule_path())
        return WorkflowScheduleConfig.from_json(schedule_json)
Esempio n. 9
0
 def test_format(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         WorkflowScheduleConfigTestCase._SCHEDULE_JSON)
     formatted_config = schedule_config.format()
     self.assertEqual(['*****@*****.**',
                       '*****@*****.**'],
                      formatted_config['emails'])
     self.assertEqual('DELAY', formatted_config['overrun_policy'])
     self.assertEqual('1d', formatted_config['recurrence'])
     self.assertEqual('2012-01-01', formatted_config['start_date'])
     self.assertEqual('00.00.01.000', formatted_config['time'])
     self.assertEqual('some_workflow', formatted_config['workflow'])
Esempio n. 10
0
 def test_format(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         WorkflowScheduleConfigTestCase._SCHEDULE_JSON)
     formatted_config = schedule_config.format()
     self.assertEqual(['*****@*****.**',
                       '*****@*****.**'],
                      formatted_config['emails'])
     self.assertEqual('DELAY', formatted_config['overrun_policy'])
     self.assertEqual('1d', formatted_config['recurrence'])
     self.assertEqual('2012-01-01', formatted_config['start_date'])
     self.assertEqual('00.00.01.000', formatted_config['time'])
     self.assertEqual('some_workflow', formatted_config['workflow'])
Esempio n. 11
0
 def test_delete_schedule(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         _SCHEDULE_TEMPLATE % 100)
     self._repository.put_schedule(schedule_config)
     self._repository.delete_schedule('some_workflow')
     self.assertEqual({}, self._repository.configs)
Esempio n. 12
0
 def test_delete_schedule(self):
     schedule_config = WorkflowScheduleConfig.from_json(
         _SCHEDULE_TEMPLATE % 100)
     self._repository.put_schedule(schedule_config)
     self._repository.delete_schedule('some_workflow')
     self.assertEqual({}, self._repository.configs)