English 中文(简体)
Boto:如何在完成/失败后保持低薪工作流动?
原标题:Boto: how to keep EMR job flow running after completion/failure?

如果工作流动没有结束,我怎么能用oto子来补充等待亚马孙婴儿死亡率的工作流动?

I ve在亚马孙弹性地图上建立了互动工作流程。 当我用Boto s emr_conn.add_jobflow_pans(......)将新步骤转至工作流程时,工作流程在完成或失败后即告终止。

我知道,我可以开始使用<代码>run_jobflow和_keep_alive para amount——的博托来进行工作流程,但我要与已经运行的流动量合作。

最佳回答

如果正确填写,则不应以<代码>keep_alive=True终止。 尽管如此,它通常会因失败而退出,因此,请在<条码>上添加<>终止_on_failure=”CONTINUE>。

问题回答

我也这样做。

生产

import boto.emr

conn = boto.emr.connect_to_region( us-west-2 )
jobid = conn.run_jobflow(name= cluster-name ,
                     ec2_keyname="yourkeyhere",
                     num_instances=3,
                     master_instance_type= m1.medium ,
                     slave_instance_type= m1.medium ,
                     keep_alive=True,
)

在现有组别中增加一项工作(对于组群在等候状态中几乎没有工作)

import boto.emr

conn = boto.emr.connect_to_region( us-west-2 )
# get the list of waiting cluster and take the first one
jobid =  conn.describe_jobflows(states=["WAITING"])[0].jobflowid
print jobid
flow_steps = list()
runThing = boto.emr.step.ScriptRunnerStep(
                        name="job step name",
                        step_args = ["s3://yours3bucket/dosmthg.sh"])
flow_steps.append(runThing)
conn.add_jobflow_steps(jobid, flow_steps)

notes

  • you need to have ~/.aws/credentials filled up (aws configure)
  • amazon region us-west-2 currently has the more recent ami version
  • you can may have to add bootstrap_actions= if you need hive, pig or custom installation steps

你们也可以这样做。

response = emr.run_job_flow(
        Name="start-my-cluster",
        ReleaseLabel="emr-5.3.1",
        LogUri= s3://logs ,
        Instances={
             InstanceGroups : [
                { Name :  EmrMaster ,
                  InstanceRole :  MASTER ,
                  InstanceType :  m3.xlarge ,
                  InstanceCount : 1},
                { Name :  EmrCore ,
                  InstanceRole :  CORE ,
                  InstanceType :  m3.xlarge ,
                  InstanceCount : 2}
            ],
             Ec2KeyName :  my-key-name ,
             KeepJobFlowAliveWhenNoSteps  : True,
        },
        Applications=[{ Name :  Hadoop }, { Name :  Spark }, { Name :  Hive }],
        JobFlowRole= EMR_EC2_DefaultRole ,
        ServiceRole= EMR_DefaultRole ,
        VisibleToAllUsers=True,
        Steps=[
            # steps go here...
        ]
        )




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签