2015-04-06 42 views
1

我有一個python API,通過bdutil和gcloud命令與現有的Google Compute Engine集羣交互。我試圖在Google App Engine上運行這個API,並且在bdutil和gcloud命令的子進程和os系統執行過程中遇到了一些問題。例如,當本地運行如何在Google App Engine上使用Python中的bdutil和gcloud?

proc = subprocess.Popen(["gcloud compute instances list"], 
         stdout=subprocess.PIPE, shell=True) 
out = proc.communicate() 

返回活躍GCE實例的列表,但是當GAE運行失敗,

AttributeError: 'module' object has no attribute 'Popen' 

我知道第三方庫必須包含在GAE項目中。我也知道上述命令也可能無法應付認證問題。如果可能的話,我正在尋求一個非常詳細的新手關於如何在GAE實例上導入,驗證和執行bdutil和gcloud命令的指令或「hello world」示例。

回答

1

您將無法從appengine應用程序運行您的示例,因爲gcloud命令是僅命令行實用程序。

如果您希望能夠通過appengine應用程序與計算引擎API進行交互,您需要將3rd party client librar y合併到您的應用程序中,並調用appropriate ap i。

相關問題