in source/services/tasks/tasks.ts [654:710]
async getAutomationExecution(taskId: string, parentExecutionId: string, automationExecutionId: string): Promise<any> {
if (!COMMON_UTIL.isStringValuesValid([taskId, parentExecutionId, automationExecutionId])) {
return Promise.reject(
COMMON_UTIL.getErrorObject('GetAutomationExecutionFailure', 400, 'Task ID, parent execution ID and automation execution ID cannot be empty.')
);
}
try {
// Checks if the execution belongs to the task from task executions table and automation executions table.
let dynamoDbParams: DocumentClient.GetItemInput = {
TableName: this.taskExecutionsTable,
Key: {
taskId,
parentExecutionId
}
}
const taskExecution = await this.documentClient.get(dynamoDbParams).promise();
if (COMMON_UTIL.isObjectEmpty(taskExecution)) {
return Promise.reject(
COMMON_UTIL.getErrorObject('GetAutomationExecutionFailure', 404, 'Task execution not found for the task.')
);
}
dynamoDbParams = {
TableName: this.automationExecutionsTable,
Key: {
parentExecutionId,
automationExecutionId
}
}
const automationExecution = await this.documentClient.get(dynamoDbParams).promise();
if (COMMON_UTIL.isObjectEmpty(automationExecution)) {
return Promise.reject(
COMMON_UTIL.getErrorObject('GetAutomationExecutionFailure', 404, 'Automation execution not found for the task.')
);
}
} catch (error) {
return Promise.reject(
COMMON_UTIL.getErrorObject('GetAutomationExecutionFailure', 500, 'Error occurred while getting an execution from DynamoDB.', error)
);
}
try {
// Gets the execution detail.
const ssmParams: AWS.SSM.GetAutomationExecutionRequest = {
AutomationExecutionId: automationExecutionId
};
let executionDetail = await this.ssm.getAutomationExecution(ssmParams).promise();
return Promise.resolve(executionDetail.AutomationExecution);
} catch (error) {
return Promise.reject(
COMMON_UTIL.getErrorObject('GetAutomationExecutionFailure', 500, 'Error occurred while getting an automation execution.', error)
);
}
}