简体   繁体   English

如何让多个虚拟机在 GCP 中的同一个脚本上工作?

[英]How can I make multiple VMs work on the same script in GCP?

I have a Python script which is supposed to create quite a lengthy list, currently the VM I am using has an 8 core processor and 30GB RAM however that is not enough as the machine runs out of memory before it can generate the list.我有一个 Python 脚本,它应该创建一个相当长的列表,目前我使用的 VM 有一个 8 核处理器和 30GB RAM,但这还不够,因为机器在生成列表之前就用完了 memory。 I am wondering, is it possible to have say 5 similar VMs and have them work on the same script and pool their resources together?我想知道,是否可以说 5 个类似的虚拟机并让它们在同一个脚本上工作并将它们的资源集中在一起? I was thinking of using a MIG however I am wondering where would I then store the script and how would they be able to communicate among them?我正在考虑使用 MIG 但是我想知道我将在哪里存储脚本以及它们如何能够在它们之间进行通信?

Resolved this issue by changing my Python script to use a generator instead of saving the list to a var and simply for loop through that generator, no need for extra processing power.通过将我的 Python 脚本更改为使用生成器而不是将列表保存到 var 并简单地循环通过该生成器来解决此问题,无需额外的处理能力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让我的 Django API 同时为多个用户工作? - How can i make my Django API work for multiple users at the same time? 如何使此Python脚本与Python 3配合使用? - How Can I Make This Python Script Work With Python 3? 如何使我的if语句与此脚本一起使用? - How can I make my if statement work with this script? 如何通过 python 脚本获取 gcp stackdriver 日志? - how can I get gcp stackdriver logs via python script? 如何在 Google 云平台 gcp 上托管 python 脚本? - How can I host a python script on Google cloud platform gcp? 如何使此代码用于 Tkinter 中的多项选择测验? - How can I make this code for a multiple choice quiz work in Tkinter? 如何在同一行中创建多个 if 语句? Python - How can I make multiple if statement in the same line? Python 我如何使用我的 json 文件中的数据来使脚本工作? - how can i use the data i have in my json file to make the script work? 创建相同类型的多个功能,谁能做到这一点? - Creating multiple functions of the same type, Can anyone make this work? 如何创建一个可以由在不同计算机上运行同一程序的多个人访问的数据库? - How can I make a database that can be accessed by multiple people running the same program on different computers?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM