Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 等待作业终止-谷歌计算引擎_Bash_Google Compute Engine_Gcloud - Fatal编程技术网

Bash 等待作业终止-谷歌计算引擎

Bash 等待作业终止-谷歌计算引擎,bash,google-compute-engine,gcloud,Bash,Google Compute Engine,Gcloud,在谷歌计算引擎上等待作业完成的最简单方法是什么?使用bashshell运行,从windows运行,使用gcloud设置 假设我启动了一个实例 gcloud compute instances create gci --image-family gci-stable --image-project google-containers \ --scopes 773889352370-compute@developer.gserviceaccount.com="https://www.googleap

在谷歌计算引擎上等待作业完成的最简单方法是什么?使用bashshell运行,从windows运行,使用gcloud设置

假设我启动了一个实例

gcloud compute instances create gci --image-family gci-stable --image-project google-containers \
--scopes 773889352370-compute@developer.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" \
--boot-disk-size "40" \
--metadata-from-file startup-script=SubmitJson.sh $MONTH
这样我就有了一个运行小作业的启动脚本(在GoogleCloudML上分析一些图像)。我想等工作完成后再继续

我可以调查它的地位

gcloud compute instances describe gci
这将返回一组很长的规格

C:\Program Files (x86)\Google\Cloud SDK>gcloud compute instances describe gci
canIpForward: false
cpuPlatform: Intel Sandy Bridge
creationTimestamp: '2017-02-19T20:42:38.878-08:00'
disks:
- autoDelete: true
  boot: true
  deviceName: persistent-disk-0
  index: 0
  interface: SCSI
  kind: compute#attachedDisk
  licenses:
  - https://www.googleapis.com/compute/v1/projects/google-containers/global/licenses/gci-public
  mode: READ_WRITE
  source: https://www.googleapis.com/compute/v1/projects/api-project-773889352370/zones/us-central1-a/disks/gci
  type: PERSISTENT
id: '4161667477774257489'
kind: compute#instance
machineType: https://www.googleapis.com/compute/v1/projects/api-project-773889352370/zones/us-central1-a/machineTypes/n1-standard-1
metadata:
  fingerprint: zaIRTnxUhBE=
  kind: compute#metadata
name: gci
networkInterfaces:
- accessConfigs:
  - kind: compute#accessConfig
    name: external-nat
    natIP: 104.197.244.99
    type: ONE_TO_ONE_NAT
  kind: compute#networkInterface
  name: nic0
  network: https://www.googleapis.com/compute/v1/projects/api-project-773889352370/global/networks/default
  networkIP: 10.128.0.2
  subnetwork: https://www.googleapis.com/compute/v1/projects/api-project-773889352370/regions/us-central1/subnetworks/default
scheduling:
  automaticRestart: true
  onHostMaintenance: MIGRATE
  preemptible: false
selfLink: https://www.googleapis.com/compute/v1/projects/api-project-773889352370/zones/us-central1-a/instances/gci
serviceAccounts:
- email: 773889352370-compute@developer.gserviceaccount.com
  scopes:
  - https://www.googleapis.com/auth/cloud-platform
status: RUNNING
tags:
  fingerprint: 42WmSpB8rSM=
zone: https://www.googleapis.com/compute/v1/projects/api-project-773889352370/zones/us-central1-a
我可以在循环中这样做,每X秒一次,等待状态被终止,但这看起来效率很低。AWS为ec2提供了等待功能。我希望看到类似的函数,但找不到。同步运行


相关问题,但请注意,我对kubernetes群集资源不感兴趣:

没有回答您的问题,但
gcloud计算实例描述了gci--format'值(状态)“
是一种获取所需信息的简单方法。它不回答您的问题,但
gcloud计算实例描述了gci--format”value(status)
是一种获取所需信息的简单方法。