是的,AWS Glue 支持条件触发器,可以根据来自另一个工作流的作业条件进行触发。在创建条件触发器时,可以设置'Workflow Names'参数来指定触发器要监视的工作流名称列表,并使用'Predicate'参数指定触发器的条件,以此根据其他工作流的作业条件进行触发。以下是一个Python代码示例,演示如何创建一个条件触发器并指定来自另一个工作流的作业条件:
import boto3
client = boto3.client('glue')
client.create_trigger(
Name='my-conditional-trigger',
Type='CONDITIONAL',
Description='My Conditional Trigger',
Actions=[
{
'JobName': 'my-job',
'Arguments': {
'--arg1': 'value1',
'--arg2': 'value2'
},
'Timeout': 2880
}
],
Predicate={
'Conditions': [
{
'LogicalOperator': 'EQUALS',
'CrawlerName': 'my-crawler',
'CrawlState': 'SUCCEEDED'
},
{
'LogicalOperator': 'EQUALS',
'JobName': 'my-other-job',
'State': 'SUCCEEDED',
'Logical': 'AND'
}
]
},
WorkflowNames=['my-workflow']
)
在上述示例中,创建了名为“ my-conditional-trigger”的条件触发器,它监视名为“ my-workflow”的工作流,并根据两个条件进行触发:来自名为“ my-crawler”的爬网器的状态为“ SUCCEEDED” 以及名为“ my-other-job”的作业达到了“ SUCCEEDED” 状态。如果这些条件都满足,将执行具有指定参数和超时时间的“ my-job”作业。