Exemplo n.º 1
0
def test__given_watch_args__when_parsing__should_return_matching_config():
    config = parse_cli_args([
        "watch",
        "test/testconfig/config.yml",
        "1234"
    ])

    assert config == WatchOptions(
        jobid="1234",
        connection=CONNECTION_DATA,
        proxyjumps=PROXYJUMPS,
    )
Exemplo n.º 2
0
def test__given_status_args__when_parsing__should_return_matching_config():
    config = parse_cli_args([
        "status",
        "test/testconfig/config.yml",
        "1234"
    ])

    assert config == SimpleJobOptions(
        jobid="1234",
        action=SimpleJobOptions.Action.status,
        connection=CONNECTION_DATA,
        proxyjumps=PROXYJUMPS,
    )
Exemplo n.º 3
0
def main() -> None:
    cli_args = parse_cli_args(sys.argv[1:])
    with RichUI() as ui:
        executor = SSHExecutor(cli_args.connection, cli_args.proxyjumps)

        filesystem_factory = PyFilesystemFactory(cli_args)
        app = Application(executor, filesystem_factory, ui)

        def on_cancel(*args: Any, **kwargs: Any) -> None:
            sys.exit(app.cancel())

        signal.signal(signal.SIGINT, on_cancel)
        sys.exit(app.run(cli_args))
Exemplo n.º 4
0
def test__given_valid_launch_args__should_return_matching_config():
    config = parse_cli_args([
        "launch",
        "--watch",
        "test/testconfig/config.yml"
    ])

    assert config == LaunchOptions(
        sbatch=REMOTE_SLURM_SCRIPT_PATH,
        connection=CONNECTION_DATA,
        proxyjumps=PROXYJUMPS,
        copy_files=[
            CopyInstruction("myfile.txt", "mycopy.txt"),
            CopyInstruction(LOCAL_SLURM_SCRIPT_PATH, REMOTE_SLURM_SCRIPT_PATH, True)],
        clean_files=["mycopy.txt", REMOTE_SLURM_SCRIPT_PATH],
        collect_files=[CopyInstruction(REMOTE_RESULT_FILEPATH, "result.txt", True)],
        watch=True
    )