|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Task Management - Execute code and scripts > MCP Commands - Task Management |
MiniRobot Language (MRL) - MCP Task Management Commands
MCP.GetJobResult
Retrieve Result of a Completed Job
Purpose
The MCP.GetJobResult command retrieves the result of a completed job without checking its status first. Unlike CheckJobResult which returns status and optionally result, this command focuses solely on getting the result data.
This command is particularly useful when:
• You already know the job has completed
• You only need the result, not the status
• Retrieving results from a list of known completed jobs
• Simplifying code when status is not needed
Syntax
MCP.GetJobResult|$$JOB_ID|$$RETURN_VAR
Parameters
$$JOB_ID - The unique job ID returned by RunCodeAsync or RunScriptAsync.
$$RETURN_VAR - The variable that will receive the job result.
Return Value
The command returns the job result output. If the job failed, it returns the error output. If the job is still running or does not exist, the behavior depends on implementation (may return empty, error message, or wait).
Examples
' Example 1: Simple result retrieval after waiting
MCP.RunCodeAsync|calculate_data()|python|$$JobId
MCP.WaitForJobResult|$$JobId|$$Status
MCP.GetJobResult|$$JobId|$$DataResult
PRT.Calculated data: $$DataResult
' Example 2: Retrieve multiple job results
' Start multiple jobs
MCP.RunCodeAsync|task1()|python|$$Job1
MCP.RunCodeAsync|task2()|python|$$Job2
MCP.RunCodeAsync|task3()|python|$$Job3
' Wait for all to complete
MCP.WaitForJobResult|$$Job1|$$R1
MCP.WaitForJobResult|$$Job2|$$R2
MCP.WaitForJobResult|$$Job3|$$R3
' Get detailed results
MCP.GetJobResult|$$Job1|$$Result1
MCP.GetJobResult|$$Job2|$$Result2
MCP.GetJobResult|$$Job3|$$Result3
' Example 3: Error handling
MCP.RunCodeAsync|risky_operation()|python|$$RiskJob
MCP.WaitForJobResult|$$RiskJob|$$RiskResult
FND.$$RiskResult|error|$$HasError
IVV.$$HasError!0
PRT.Operation failed: $$RiskResult
ELS.
PRT.Operation succeeded: $$RiskResult
EIF.
Remarks
GetJobResult is a simple way to retrieve results when you already know the job status (e.g., after using WaitForJobResult). It provides direct access to the result data without the overhead of status checking.
The result remains available even after retrieval, until the job is cleaned up using MCP.CleanupJobs. This allows multiple retrievals if needed.
If you need both status and result information, use CheckJobResult instead.
Error Conditions
The command will fail with a parameter error if:
• The job ID parameter is missing
• The return variable parameter is missing
• The job ID does not exist or was cleaned up
See also:
• MCP.CheckJobResult - Check Job Result
• MCP.WaitForJobResult - Wait for Job Completion
• MCP.CleanupJobs - Clean Up Jobs