I am attempting to update a trigger to change the job it is triggering. I have referred to the documentation (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glue.html#Glue.Client.get_trigger)
My code:
# Update the trigger
client.update_trigger(
Name='myTrigger',
TriggerUpdate = {
'Actions': [
{
'JobName': 'JobToTrigger'
}
]
}
)
However the resulting error is:
botocore.errorfactory.InvalidInputException: An error occurred (InvalidInputException) when calling the UpdateTrigger operation:
I have confirmed that the trigger name is correct as I have used the "get_trigger" call to obtain its details and tried to use that output as a template, but unfortunately to no avail. I assume I have not followed the correct syntax or I am missing a required parameter but unfortunately as you can see the error messaging is fairly vague.
Any help would be greatly appreciated.
CodePudding user response:
I was able to get your script working by adding schedule to it which seems to be mandatory field .I agree that the error is vague which indicates any thing can be wrong with your input. Try below script which should update the job details for your trigger.
If you are not using schedule
then try passing appropriate Trigger type.
import boto3
from botocore.exceptions import ClientError
session = boto3.session.Session()
glue_client = session.client('glue')
response = glue_client.update_trigger(
Name='test',
TriggerUpdate={
'Name': 'test',
'Schedule': 'cron(15 12 * * ? *)',
'Actions': [
{
'JobName': 'test2'
},
],
}
)