|
2 | 2 |
|
3 | 3 | from paperspace import client, config |
4 | 4 | from paperspace.cli import common |
| 5 | +from paperspace.cli.common import del_if_value_is_none |
5 | 6 | from paperspace.commands import jobs as jobs_commands |
6 | 7 |
|
7 | 8 |
|
@@ -63,8 +64,29 @@ def list_jobs(api_key, **filters): |
63 | 64 |
|
64 | 65 |
|
65 | 66 | @jobs_group.command("create", help="Create job") |
| 67 | +@click.option("--name", "name", help="Job name", required=True) |
| 68 | +@click.option('--machineType', 'machineType', help="Virtual machine type") |
| 69 | +@click.option('--container', 'container', help="Docker container") |
| 70 | +@click.option('--command', 'command', help="Job command/entrypoint") |
| 71 | +@click.option('--ports', 'ports', help="Mapped ports") |
| 72 | +@click.option('--isPublic', 'isPublic', help="Flag: is job public") |
| 73 | +@click.option("--workspace", "workspace", required=False, help="Path to workspace directory") |
| 74 | +@click.option("--workspaceArchive", "workspaceArchive", required=False, help="Path to workspace archive") |
| 75 | +@click.option("--workspaceUrl", "workspaceUrl", required=False, help="Project git repository url") |
| 76 | +@click.option("--workingDirectory", "workingDirectory", help="Working directory for the experiment", ) |
| 77 | +@click.option('--experimentId', 'experimentId', help="Experiment Id") |
| 78 | +# @click.option('--envVars', 'envVars', help="Environmental variables ") # TODO |
| 79 | +@click.option('--useDockerfile', 'useDockerfile', help="Flag: using Dockerfile") |
| 80 | +@click.option('--isPreemptible', 'isPreemptible', help="Flag: isPreemptible") |
| 81 | +@click.option('--project', 'project', help="Project name") |
| 82 | +@click.option('--projectHandle', '--projectId', 'projectId', help="Project handle", required=True) |
| 83 | +@click.option('--startedByUserId', 'startedByUserId', help="User ID") |
| 84 | +@click.option('--relDockerfilePath', 'relDockerfilePath', help="Relative path to Dockerfile") |
| 85 | +@click.option('--registryUsername', 'registryUsername', help="Docker registry username") |
| 86 | +@click.option('--registryPassword', 'registryPassword', help="Docker registry password") |
66 | 87 | @common.api_key_option |
67 | 88 | def create_job(api_key, **kwargs): |
| 89 | + del_if_value_is_none(kwargs) |
68 | 90 | jobs_api = client.API(config.CONFIG_HOST, api_key=api_key) |
69 | 91 | command = jobs_commands.CreateJobCommand(api=jobs_api) |
70 | 92 | command.execute(kwargs) |
0 commit comments