def execute( self, run_args ): engine_id = run_args.get( 'engine', None ) if engine_id is None: engine_id = 'serial' wpsLog.warning( "Compute Engine not confgured, running serially.") engine = engineRegistry.getInstance( engine_id ) result = engine.execute( run_args ) return result
def execute( self, tesk_request ): try: if self.engine is None: engine_id = tesk_request[ 'engine' ] if engine_id is None: engine_id = 'serial' wpsLog.warning( "Compute Engine not confgured, running serially.") self.engine = engineRegistry.getInstance( engine_id ) wpsLog.debug( "Executing engine '%s', class: %s" % ( self.engine.id, self.engine.__class__.__name__ ) ) result = self.engine.execute( tesk_request ) return result except Exception, err: wpsLog.debug( "Exception in staging handler: '%s'\n%s" % ( str(err), traceback.format_exc() ) ) return {}
def cdas(): task_run_args = get_request_datainputs() data = task_run_args['data'] region = task_run_args['region'] operation = task_run_args['operation'] wpsLog.debug( " $$$ CDAS Process: DataIn='%s', Domain='%s', Operation='%s', ---> Time=%.3f " % ( str( data ), str( region ), str( operation ), time.time() ) ) t0 = time.time() handler = stagingRegistry.getInstance( configuration.CDAS_STAGING ) if handler is None: wpsLog.warning( " Staging method not configured. Running locally on wps server. " ) handler = stagingRegistry.getInstance( 'local' ) result_obj = handler.execute( { 'data':data, 'region':region, 'operation':operation, 'engine': configuration.CDAS_COMPUTE_ENGINE + "Engine" } ) wpsLog.debug( " $$$*** CDAS Process (response time: %.3f sec):\n Result='%s' " % ( (time.time()-t0), str(result_obj) ) ) result_json = json.dumps( result_obj ) # resp = flask.make_response( json.dumps(result), 200 ) return result_json