I'm using disk snapshots for backing up MongoDB data. I'm taking a snapshot every 2 hours using a python script. But, the API calls return immediately and doesn't wait for the snapshot to complete. Is there any way I can wait in the script till snapshots complete. Or Is there a way to configure GCP to send alerts if snapshot operation fails?
--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-discussion@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussion+unsubscribe@googlegroups.com.
To post to this group, send email to gce-discussion@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/b4ab4640-c44d-4342-b15a-d15bbc0490a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
for row in shard_to_disk_mappings:
snapshot_name = "mongo-" + row.shard + "-" + str(int(start_time))
zone = row.zone
disk = row.disk
snapshot_body = {
"name" : snapshot_name,
"labels" : {
"shard" : row.shard,
"type": snapshot_type # This is set to hourly/daily/weekly, value comes from command line.
}
}
request = service.disks().createSnapshot(project=project, zone=zone, disk=disk, body=snapshot_body)
response = request.execute()