I have been using this example of creating a Vertex AI monitoring job. It sends an email and have adapted it to send a Pubsub message, with @Jose Gutierrez Paliza's help.
I have got this working, sort of. But what seems to be happening is that Pubsub pushes the log to a function which errors.
When I look at logs I see an INFO entry:
my-fn an_id Event data: {"insertId":"another_id...
followed by a separate ERROR entry:
...
ValueError: The pipeline parameter insertId is not found in the pipeline job input definitions.
So I assume Pubsub is sending the log to the function which gets extraneous crap, including insertId.
I can run the pipeline fine via Jupyter:
from google.cloud import pubsub
publish_client = pubsub.PublisherClient()
topic = f'projects/{PROJECT}/topics/{PUBSUB_TOPIC}'
data = {}
message = json.dumps(data)
_ = publish_client.publish(topic, message.encode())
So how do I the equivalent via Pubsub?
