class jobExecutionList(Resource): @nsJobs.doc('postexecution') @nsJobs.expect(getJobExecutionCreationModel(appObj), validate=True) @appObj.flastRestPlusAPIObject.response(400, 'Validation error') @appObj.flastRestPlusAPIObject.response(200, 'Success') @appObj.flastRestPlusAPIObject.marshal_with( getJobExecutionModel(appObj), code=200, description='Job created') def post(self, guid): '''Create Job Execution''' content = request.get_json() return appObj.jobExecutor.submitJobForExecution( guid, content['name'], True) @nsJobs.doc('getjobexecutions') @nsJobs.marshal_with( appObj.getResultModel(getJobExecutionModel(appObj))) @appObj.flastRestPlusAPIObject.response(200, 'Success') @appObj.addStandardSortParams(nsJobs) def get(self, guid): '''Get Job Executions''' def outputJobExecution(item): return item def filterJobExecution( item, whereClauseText ): #if multiple separated by spaces each is passed individually and anded together return True return appObj.getPaginatedResult( appObj.jobExecutor.getAllJobExecutions(guid), outputJobExecution, request, filterJobExecution)
class job(Resource): '''Show a single execution Job''' @nsJobExecutions.doc('get_jobexecution') @nsJobExecutions.marshal_with(getJobExecutionModel(appObj)) def get(self, guid): '''Fetch a given resource''' execution = appObj.jobExecutor.getJobExecutionStatus(guid) if execution is None: raise BadRequest('Invalid Job Execution Identifier') return execution
class executionList(Resource): '''Operations relating to jobs''' @nsJobExecutions.doc('getexecutions') @nsJobExecutions.marshal_with( appObj.getResultModel(getJobExecutionModel(appObj))) @appObj.flastRestPlusAPIObject.response(200, 'Success') @nsJobExecutions.param('offset', 'Number to start from') @nsJobExecutions.param('pagesize', 'Results per page') @nsJobExecutions.param('query', 'Search Filter') def get(self): '''Get Job Executions''' def outputJobExecution(item): return item def filterJobExecution(item, whereClauseText): return True return appObj.getPaginatedResult( appObj.jobExecutor.getAllJobExecutions(None), outputJobExecution, request, filterJobExecution)