Usage example
This example demonstrates running an execution in an already-configured Xpress Executor component.
You will need to fill in the model parameters with your Xpress Executor component details.
model ExecutorExecuteExample uses "executor" parameters COMPONENT_URL = "" BEARER_TOKEN_URL = "" CLIENT_ID = "" SECRET = "" end-parameters declarations INPUT_FILE="MyExecutionInputFile.dat" RESULT_FILE="MyExecutionResultFile.dat" myexecutor: Executor myexecution: ModelExecution EXECUTION_TIMEOUT = 10*60 ! Timeout in seconds end-declarations ! Configure 'myexecutor' with our Xpress Executor component details myexecutor.componenturl := COMPONENT_URL myexecutor.bearertokenurl := BEARER_TOKEN_URL myexecutor.clientid := CLIENT_ID myexecutor.secret := SECRET ! Start execution passing local input data myexecution := executorexecute(myexecutor,INPUT_FILE) if myexecutor.status<>EXECUTOR_OK then writeln("Error from Executor when starting execution: ",myexecutor.lasterror) exit(1) end-if ! Wait for execution to complete executorwaitfor(myexecutor,myexecution,EXECUTION_TIMEOUT) if myexecutor.status<>EXECUTOR_OK then writeln("Error from Executor when waiting for completion: ",myexecutor.lasterror) ! If execution did not complete within time limit, display error elif not myexecution.iscompleted then writeln("Execution failed to complete within ",EXECUTION_TIMEOUT,"s") ! If execution completed with error, display error elif myexecution.status<>EXECUTION_STATUS_OK or myexecution.exitcode<>0 then writeln("Execution failed with status ",myexecution.status," and exit code ",myexecution.exitcode) ! In error cases, execution run log will contain valuable information executorfetchrunlog(myexecutor,myexecution,"runlog.txt") if myexecutor.status<>EXECUTOR_OK then writeln("Error from Executor when fetching run log: ",myexecutor.lasterror) else writeln("Run log saved in file runlog.txt") end-if ! If execution completed ok, download result else ! Completed okay, download results executorfetchresult(myexecutor,myexecution,RESULT_FILE) if myexecutor.status<>EXECUTOR_OK then writeln("Error from Executor when fetching results: ",myexecutor.lasterror) else writeln("Result data saved in file ",RESULT_FILE) end-if end-if ! Delete execution from server executordelete(myexecutor,myexecution) if myexecutor.status<>EXECUTOR_OK then writeln("Error from Executor when deleting execution: ",myexecutor.lasterror) exit(1) end-if end-model
© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.