![](/img/trans.png)
[英]Amazon SQS, Boto, and Python: Fetching and Running a Script on Amazon EC2
[英]What are the steps involved in running the same python script in parallel in amazon ec2 or picloud
我需要一些關於並行處理任務的幫助,我試圖盡快完成。
它只是將大型數據幀拆分為較小的塊並在每個塊上運行相同的腳本。
我認為這被稱為令人難以置信的平行。
如果有人可以使用亞馬遜雲服務或picloud建議模板來完成此任務,我將非常感激。
我已經初步嘗試了亞馬遜ec2和picloud(我將在每個數據塊上運行的腳本在python中)但是我意識到如果沒有一些幫助我可能無法弄清楚如何做到這一點。
因此,任何指針都將非常感激。 我只是在尋找基本的幫助(對於那些知道的人),例如使用ec2或picloud等設置並行內核或cpus的主要步驟,並行運行腳本,並保存腳本輸出,即腳本將其計算結果寫入csv文件。
我正在運行ubuntu 12.04,我的python 2.7腳本不涉及非站點庫,只是os和csv。 腳本並不復雜,只是數據對於我的機器和時間范圍來說太大了。
此腳本使用PiCloud的Python雲庫,應該在本地運行。
# chunks is a list of filenames (you'll need to define generate_chunk_files)
chunks = generate_chunk_files('large_dataframe')
for chunk in chunks:
# stores each chunk in your PiCloud bucket
cloud.bucket.put(chunk)
def process_chunk(chunk):
"""Runs on PiCloud"""
# saves chunk object locally
cloud.bucket.get(chunk)
f = open(chunk, 'r')
# process the data however you want
# asynchronously runs process_chunk on the cloud for all chunks
job_ids = cloud.map(process_chunk, chunks)
使用實時核心功能分配特定數量的核心。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.