def post(self):
        data = IocManager.api.payload
        rune_date_string = data.get('RunDate')  #
        value = data.get('value')  #
        value_for_sum = data.get('value_for_sum')
        if rune_date_string is None or rune_date_string == '':
            return CommonModels.get_error_response(message="RunDate Requeired")

        run_date = datetime.strptime(rune_date_string, "%Y-%m-%dT%H:%M:%S.%fZ")
        ap_scheduler_job = self.job_operation_service.add_job_with_date(job_function=TestScheduler.sum,
                                                                        run_date=run_date,
                                                                        args=(None, value, value_for_sum,))
        result = JobModels.get_ap_scheduler_job_model(ap_scheduler_job)
        return CommonModels.get_response(result=result)
 def put(self):
     """
     Update existing Data Operation cron job
     """
     data = IocManager.api.payload
     code = data.get('Code')  #
     cron = data.get('Cron')  #
     start_date = data.get('StartDate')  #
     end_date = data.get('EndDate')  #
     start_operation_result = self.job_operation_service.modify_job(
         code=code, cron=cron, start_date=start_date, end_date=end_date)
     if isinstance(start_operation_result, DataOperationJob):
         result = JobSchedulerModels.get_data_operation_job_model(
             start_operation_result)
         return CommonModels.get_response(result=result)
     else:
         message = start_operation_result
         return CommonModels.get_error_response(message=message)
Exemple #3
0
 def get(self, job_id):
     ap_scheduler_job = self.ap_scheduler_job_repository.get_by_id(job_id)
     if ap_scheduler_job is None:
         return CommonModels.get_error_response(f"Job {job_id} not  found")
     result = JobModels.get_ap_scheduler_job_model(ap_scheduler_job)
     return CommonModels.get_response(result=result)