我已经实现了一个 EXPRESS 状态机,并且正在尝试检索状态机的执行列表。下面是我的代码片段:
const stepFunction = new SFN({ region: REGION });
const listExecutionsInput = {
stateMachineArn: STATE_MACHINE_ARN,
statusFilter: ExecutionStatus.RUNNING,
};
const runningStateMachines = await stepFunction.listExecutions(listExecutionsInput);
但是,它会引发以下错误:
{
message: 'This operation is not supported by this type of state machine',
error: {
name: 'StateMachineTypeNotSupported',
$fault: 'client',
$metadata: {
httpStatusCode: 400,
requestId: 'ciefq5881-6713-4662-b8fe-e0ddqa9ef4d1',
attempts: 1,
totalRetryDelay: 0,
},
__type: 'com.amazonaws.swf.service.v2.model#StateMachineTypeNotSupported',
},
platform: 'Unknown',
releaseId: 'Unknown',
incomingHttpRequest: {},
fatal: true,
}
经过进一步调查,我发现 EXPRESS 状态机不支持 listExecutions API 操作。我想知道是否有替代 API 操作可以至少提供最近执行的名称。可以请您指教吗?
有关更多上下文,您可以参考文档:https://docs.aws.amazon.com/step-functions/latest/apireference/API_ListExecutions.html
这是标准工作流程和快速工作流程之间的主要区别之一。您可以在此处阅读有关这些内容的更多信息:https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html
Express Workflows 不维护 Step Functions 服务中的执行列表。但是,您可以选择启用将执行历史记录记录到 CloudWatch Logs,然后从日志中查询此信息(例如,使用 CloudWatch Logs Insights)。 Step Functions 控制台包含一个选项,用于显示日志中的此信息,您也可以启用该选项(此处有更多详细信息)。