def get(self, value, count): run_date = datetime.now() ap_scheduler_job = self.job_operation_service.add_job_with_date(job_function=TestParallelScheduler.operation, run_date=run_date, args=(None, value, count,)) result = JobModels.get_ap_scheduler_job_model(ap_scheduler_job) return CommonModels.get_response(result=result)
def post(self): data = IocManager.api.payload start_date = data.get('StartDate') # end_date = data.get('EndDate') # cron = data.get('Cron') # value = data.get('value') # value_for_sum = data.get('value_for_sum') ap_scheduler_job = self.job_operation_service.add_job_with_cron(job_function=TestScheduler.sum, cron=cron, start_date=start_date, end_date=end_date, args=(None, value, value_for_sum)) result = JobModels.get_ap_scheduler_job_model(ap_scheduler_job) return CommonModels.get_response(result=result)
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 get_data_operation_job_model( data_operation_job: DataOperationJob) -> DataOperationJobModel: entity_model = DataOperationJobModel( Id=data_operation_job.Id, Cron=data_operation_job.Cron, StartDate=data_operation_job.StartDate, EndDate=data_operation_job.EndDate, DataOperationId=data_operation_job.DataOperationId, ApSchedulerJobId=data_operation_job.ApSchedulerJobId, IsDeleted=data_operation_job.IsDeleted, ) result_model = json.loads( json.dumps(entity_model.__dict__, default=CommonModels.date_converter)) result_model[ 'DataOperation'] = DataOperationModels.get_data_operation_result_model( data_operation_job.DataOperation) result_model['ApSchedulerJob'] = JobModels.get_ap_scheduler_job_model( data_operation_job.ApSchedulerJob) return result_model
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)
def get(self): ap_scheduler_jobs = self.ap_scheduler_job_repository.filter_by( IsDeleted=0).all() result = JobModels.get_ap_scheduler_job_models(ap_scheduler_jobs) return CommonModels.get_response(result=result)
def get(self, job_id): ap_scheduler_job_events = self.ap_scheduler_job_event_repository.filter_by(ApSchedulerJobId=job_id).all() result = JobModels.get_ap_scheduler_job_events_model(ap_scheduler_job_events) return CommonModels.get_response(result)