简体   繁体   English

如何在EMR中的特定实例组上运行脚本

[英]How to run script on specific instance group in EMR

I am stuck with a task, where I have to run 1 script only on Task instance group instances. 我受困于一项任务,在该任务中,我只能在任务实例组实例上运行1个脚本。

My current approach- 我目前的做法-

For this, I passes script as a Bootstrap Actions while cluster launch, but it run scripts on all machines. 为此,我在群集启动时将脚本作为Bootstrap Actions传递,但是它在所有计算机上运行脚本。 (master, core, task instance groups). (主,核心,任务实例组)。

Can you please help me to run that script only on specific(task) instance group ? 您能帮我只在特定的(任务)实例组上运行该脚本吗?

Actual task is to run termination notice polling script on task instance groups instances. 实际任务是在任务实例组实例上运行终止通知轮询脚本。 - https://blog.fugue.co/2015-01-06-spot-termination-notices.html -https://blog.fugue.co/2015-01-06-spot-termination-notices.html

You can look at the file /mnt/var/lib/info/extraInstanceData.json which contains the key instanceRole value which is either master, core or task. 您可以查看文件/mnt/var/lib/info/extraInstanceData.json ,其中包含关键的instanceRole值,该值可以是master,core或task。 For example, add this to your script: 例如,将其添加到脚本中:

INSTANCE_ROLE=$(jq .instanceRole /mnt/var/lib/info/extraInstanceData.json)

Or, you can use this file /mnt/var/lib/info/instance.json that exists on any node in the cluster, it looks like this: 或者,您可以使用群集中任何节点上存在的/mnt/var/lib/info/instance.json文件,它看起来像这样:

  {
    "instanceGroupId": "ig-XXXXXXXXXX",
    "isMaster": false
  }

You can match the ig-XXXXXXXXXX to your cluster's TASK group ID. 您可以将ig-XXXXXXXXXX与集群的任务组ID相匹配。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM