Exemple #1
0
def test_run_with_steps_instance_groups(mock_emr_client, mock_ec2_client):
    response = HandleEMRCommands("tests/configs/emrcliconfig_inst_groups.yaml",
                                 with_steps=True,
                                 profile_name=None,
                                 overwrite_auto_terminate=True).create()
    assert response['ResponseMetadata']['HTTPStatusCode'] == 200
    assert response["JobFlowId"] == "s-SNGBtA88"
Exemple #2
0
def create_with_steps(ctx, config, profile, keep_alive, date, step_name,
                      step_idx, custom_vars):
    if step_name is not None and step_idx is not None:
        print('You can use --step_name or --step_idx not both.')
        raise click.Abort()

    local_custom_vars = get_custom_vars(custom_vars)

    HandleEMRCommands(config, with_steps=True, profile_name=profile, overwrite_auto_terminate=True) \
        .create(
        keep_alive=keep_alive, user_date=date, user_step_name=step_name, user_step_idx=step_idx,
        user_custom_vars=local_custom_vars)
Exemple #3
0
def submit_steps(ctx, config, profile, cid, date, step_name, step_idx,
                 custom_vars):
    if step_name is not None and step_idx is not None:
        print('You can use --step_name or --step_idx not both.')
        raise click.Abort()

    local_custom_vars = get_custom_vars(custom_vars)

    HandleEMRCommands(config,
                      with_steps=True,
                      profile_name=profile,
                      user_job_flow_id=cid).add_steps(
                          user_date=date,
                          user_step_name=step_name,
                          user_step_idx=step_idx,
                          user_custom_vars=local_custom_vars)
Exemple #4
0
def test_add_steps_selected_by_name(mock_emr_client, mock_ec2_client):
    response = HandleEMRCommands(
        "tests/configs/emrcliconfig_inst_groups.yaml",
        profile_name=None).add_steps(user_step_name="Step1,Step2")
    assert response['ResponseMetadata']['HTTPStatusCode'] == 200
Exemple #5
0
def test_create_cluster_instance_fleet(mock_emr_client, mock_ec2_client):
    response = HandleEMRCommands("tests/configs/emrcliconfig_inst_fleets.yaml",
                                 profile_name=None).create()
    assert response['ResponseMetadata']['HTTPStatusCode'] == 200
    assert response["JobFlowId"] == "s-SNGBtA88"
Exemple #6
0
def test_terminate_cluster(mock_emr_client, mock_ec2_client):
    response = HandleEMRCommands("tests/configs/emrcliconfig_inst_groups.yaml",
                                 profile_name=None).terminate()
    assert response['ResponseMetadata']['HTTPStatusCode'] == 200
Exemple #7
0
def test_script_runner(mock_emr_client, mock_ec2_client, mock_copy_file,
                       mock_run_command):
    hosts = HandleEMRCommands("tests/configs/emrcliconfig_inst_groups.yaml",
                              profile_name=None).script_runner()
    assert len(hosts) == 6
Exemple #8
0
def test_run_with_steps_selected_by_idx(mock_emr_client, mock_ec2_client):
    response = HandleEMRCommands("tests/configs/emrcliconfig_inst_groups.yaml",
                                 with_steps=True,
                                 profile_name=None).create(user_step_idx="1:2")
    assert response['ResponseMetadata']['HTTPStatusCode'] == 200
    assert response["JobFlowId"] == "s-SNGBtA88"
Exemple #9
0
def create(ctx, config, profile):
    HandleEMRCommands(config, profile_name=profile).create()
Exemple #10
0
def install(ctx, config, profile, pem, cid, quiet):
    HandleEMRCommands(config, profile_name=profile,
                      user_job_flow_id=cid).install(user_pem=pem,
                                                    quiet_mode=quiet)
Exemple #11
0
def script_runner(ctx, config, profile, pem, cid, script, quiet):
    HandleEMRCommands(config, profile_name=profile, user_job_flow_id=cid) \
        .script_runner(user_pem=pem, user_script_name=script, quiet_mode=quiet)
Exemple #12
0
def ssh(ctx, config, profile, pem, cid):
    HandleEMRCommands(config, profile_name=profile,
                      user_job_flow_id=cid).ssh(user_pem=pem)
Exemple #13
0
def terminate(ctx, config, profile, cid):
    if click.confirm('Are you sure you want to terminate cluster?',
                     abort=True):
        HandleEMRCommands(config, profile_name=profile,
                          user_job_flow_id=cid).terminate()