Skip to content

Commit

Permalink
feat(asset-cli): added asset subcommand template and placeholder comm…
Browse files Browse the repository at this point in the history
…ands (#354)

Signed-off-by: Tang <[email protected]>
  • Loading branch information
stangch authored Jun 24, 2024
1 parent a95da98 commit 70d2cc5
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/deadline/client/cli/_deadline_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from ._groups.job_group import cli_job
from ._groups.queue_group import cli_queue
from ._groups.worker_group import cli_worker
from ._groups.asset_group import cli_asset

logger = getLogger(__name__)

Expand Down Expand Up @@ -76,3 +77,4 @@ def main(ctx: click.Context, log_level: str):
main.add_command(cli_job)
main.add_command(cli_queue)
main.add_command(cli_worker)
main.add_command(cli_asset)
95 changes: 95 additions & 0 deletions src/deadline/client/cli/_groups/asset_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""
All the `deadline asset` commands:
* snapshot
* upload
* diff
* download
"""

import click

from .._common import _handle_error


@click.group(name="asset")
@_handle_error
def cli_asset():
"""
Commands to work with AWS Deadline Cloud Job Attachments.
"""


@cli_asset.command(name="snapshot")
@click.option("--root-dir", help="The root directory to snapshot. ")
@click.option("--manifest-out", help="Destination path to directory where manifest is created. ")
@click.option(
"--recursive",
"-r",
help="Flag to recursively snapshot subdirectories. ",
is_flag=True,
show_default=True,
default=False,
)
@_handle_error
def asset_snapshot(**args):
"""
Creates manifest of files specified root directory.
"""
click.echo("snapshot taken")


@cli_asset.command(name="upload")
@click.option(
"--manifest", help="The path to manifest folder of the directory specified for upload. "
)
@click.option("--farm-id", help="The AWS Deadline Cloud Farm to use. ")
@click.option("--queue-id", help="The AWS Deadline Cloud Queue to use. ")
@click.option(
"--update",
help="Flag to update manifest before upload. ",
is_flag=True,
show_default=True,
default=False,
)
@_handle_error
def asset_upload(**args):
"""
Uploads the assets in the provided manifest file to S3.
"""
click.echo("upload done")


@cli_asset.command(name="diff")
@click.option("--root-dir", help="The root directory to compare changes to. ")
@click.option(
"--manifest", help="The path to manifest folder of the directory to show changes of. "
)
@click.option(
"--format",
help="Pretty prints diff information with easy to read formatting. ",
is_flag=True,
show_default=True,
default=False,
)
@_handle_error
def asset_diff(**args):
"""
Check file differences of a directory since last snapshot.
TODO: show example of diff output
"""
click.echo("diff shown")


@cli_asset.command(name="download")
@click.option("--farm-id", help="The AWS Deadline Cloud Farm to use.")
@click.option("--queue-id", help="The AWS Deadline Cloud Queue to use.")
@click.option("--job-id", help="The AWS Deadline Cloud Job to get. ")
@_handle_error
def asset_download(**args):
"""
Downloads input manifest of previously submitted job.
"""
click.echo("download complete")

0 comments on commit 70d2cc5

Please sign in to comment.