Ejemplo n.º 1
0
def run(job_cmd, dry_run):
    """Runs the JOB_CMD command on an EC2 instance.

    JOB_CMD is any command you would run locally.\n
    E.g. \"python runner.py --epochs=10\".\n
    The command must be between quotes.
    """
    execute.run_job(job_cmd, dry_run)
Ejemplo n.º 2
0
def run(job_cmd, dry_run):
    """Runs the JOB_CMD command on an EC2 instance.

    JOB_CMD is any command you would run locally.\n
    E.g. \"python runner.py --epochs=10\".\n
    The command must be between quotes. 
    """
    session, config = get_session_and_config_full_check()
    execute.run_job(session, config, job_cmd, dry_run)
Ejemplo n.º 3
0
def test_spot_launch(runner: CliRunner):
    CONFIG.spot = True
    response = execute.run_job("_nimbo_launch", dry_run=False)

    assert response["message"] == "_nimbo_launch_success"
    instance_id = response["instance_id"]

    result = runner.invoke(cli,
                           f"delete-instance {instance_id}",
                           catch_exceptions=False)
    assert result.exit_code == 0
Ejemplo n.º 4
0
def test_launch(runner: CliRunner):
    dst = os.getcwd()
    instance_keys = [p for p in os.listdir(dst) if p[-4:] == ".pem"]

    for instance_key in instance_keys:
        for region_name in FULL_REGION_NAMES.keys():
            if instance_key.startswith(region_name):
                CONFIG.region_name = region_name
                break
        else:
            raise Exception(
                f"Instance key {instance_key} does not begin with a valid region name"
            )

        CONFIG.instance_key = instance_key
        response = execute.run_job("_nimbo_launch", dry_run=False)

        assert response["message"] == "_nimbo_launch_success"
        instance_id = response["instance_id"]

        result = runner.invoke(cli,
                               f"delete-instance {instance_id}",
                               catch_exceptions=False)
        assert result.exit_code == 0
Ejemplo n.º 5
0
def launch_and_setup(dry_run):
    """
    Launches an EC2 instance with your code, data and environment,
    without running any job.
    """
    execute.run_job("_nimbo_launch_and_setup", dry_run)
Ejemplo n.º 6
0
def launch(dry_run):
    """
    Launches an EC2 instance according to your nimbo-config,
    without doing any further setup.
    """
    execute.run_job("_nimbo_launch", dry_run)
Ejemplo n.º 7
0
def launch_and_setup(dry_run):
    """Launches an EC2 instance with your code, data and environment, without running any job."""
    session, config = get_session_and_config_full_check()
    execute.run_job(session, config, "_nimbo_launch_and_setup", dry_run)
Ejemplo n.º 8
0
def launch(dry_run):
    """Launches an EC2 instance according to your nimbo-config, without doing any further setup."""
    session, config = get_session_and_config_full_check()
    execute.run_job(session, config, "_nimbo_launch", dry_run)