diff --git a/README.md b/README.md index 8f18cc5f..2b5b4192 100644 --- a/README.md +++ b/README.md @@ -63,4 +63,4 @@ create a copy of [`sample.env`](./abcli/sample.env) as `.env` and fill in the se [![pylint](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/awesome-bash-cli/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/abcli.svg)](https://pypi.org/project/abcli/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/abcli)](https://pypistats.org/packages/abcli) -built by 🌀 [`blue_options-4.148.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.395.1`](https://github.com/kamangir/awesome-bash-cli). +built by 🌀 [`blue_options-4.148.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.396.1`](https://github.com/kamangir/awesome-bash-cli). diff --git a/abcli/.abcli/tests/help.sh b/abcli/.abcli/tests/help.sh index 53f0d167..f26a20dc 100644 --- a/abcli/.abcli/tests/help.sh +++ b/abcli/.abcli/tests/help.sh @@ -5,6 +5,12 @@ function test_abcli_help() { local module for module in \ + "@batch browse" \ + "@batch cat" \ + "@batch eval" \ + "@batch list" \ + "@batch submit" \ + \ "@docker browse " \ "@docker build " \ "@docker clear " \ diff --git a/abcli/__init__.py b/abcli/__init__.py index 390b1c41..e02b297a 100644 --- a/abcli/__init__.py +++ b/abcli/__init__.py @@ -6,7 +6,7 @@ DESCRIPTION = f"{ICON} a language to speak AI." -VERSION = "9.395.1" +VERSION = "9.396.1" REPO_NAME = "awesome-bash-cli" diff --git a/abcli/config.env b/abcli/config.env index e9e8971d..608dcd54 100644 --- a/abcli/config.env +++ b/abcli/config.env @@ -38,4 +38,6 @@ abcli_aws_ec2_key_name=bolt abcli_papertrail_dest_host=logs3.papertrailapp.com abcli_papertrail_dest_port=30742 +ABCLI_AWS_BATCH_JOB_STATUS_LIST=SUBMITTED,PENDING,RUNNABLE,STARTING,RUNNING,SUCCEEDED,FAILED + ABCLI_TEST_OBJECT=vanwatch-test-object-v2 \ No newline at end of file diff --git a/abcli/env.py b/abcli/env.py index 947faea9..ffefbc13 100644 --- a/abcli/env.py +++ b/abcli/env.py @@ -74,3 +74,5 @@ ABCLI_TEST_OBJECT = os.getenv("ABCLI_TEST_OBJECT", "") ABCLI_MLFLOW_STAGES = os.getenv("ABCLI_MLFLOW_STAGES", "") + +ABCLI_AWS_BATCH_JOB_STATUS_LIST = os.getenv("ABCLI_AWS_BATCH_JOB_STATUS_LIST", "") diff --git a/abcli/help/aws_batch.py b/abcli/help/aws_batch.py new file mode 100644 index 00000000..1dba0d9b --- /dev/null +++ b/abcli/help/aws_batch.py @@ -0,0 +1,156 @@ +from typing import List + +from abcli import env + +from blue_options.terminal import show_usage, xtra + + +def help_browse( + tokens: List[str], + mono: bool, +) -> str: + # --- + options = "cat,id=,log" + + usage_1 = show_usage( + [ + "@batch", + "browse", + f"[{options}]", + ], + "browse .", + mono=mono, + ) + + # --- + options = "queue=,status=" + + usage_2 = show_usage( + [ + "@batch", + "browse", + f"[{options}]", + ], + "browse .", + { + "status: {}".format( + " | ".join(env.ABCLI_AWS_BATCH_JOB_STATUS_LIST.split(",")) + ): "", + }, + mono=mono, + ) + + # --- + options = "queue=list" + + usage_3 = show_usage( + [ + "@batch", + "browse", + f"[{options}]", + ], + "browse list of queues.", + mono=mono, + ) + + return "\n".join( + [ + usage_1, + usage_2, + usage_3, + ] + ) + + +def help_cat( + tokens: List[str], + mono: bool, +) -> str: + options = "-" + + return show_usage( + [ + "@batch", + "cat", + f"[{options}]", + "", + ], + "cat .", + mono=mono, + ) + + +def help_eval( + tokens: List[str], + mono: bool, +) -> str: + options = "cat,dryrun,name=" + + return show_usage( + [ + "@batch", + "eval", + f"[{options}]", + "", + ], + "eval in aws batch.", + mono=mono, + ) + + +def help_list( + tokens: List[str], + mono: bool, +) -> str: + options = "".join( + [ + "~count", + xtra( + ",dryrun,prefix=,status=", + mono=mono, + ), + ] + ) + + return show_usage( + [ + "@batch", + "list", + f"[{options}]", + ], + "list aws batch jobs.", + { + "status: {}".format( + " | ".join(env.ABCLI_AWS_BATCH_JOB_STATUS_LIST.split(",")) + ): "", + }, + mono=mono, + ) + + +def help_submit( + tokens: List[str], + mono: bool, +) -> str: + options = "cat,dryrun,name=" + + return show_usage( + [ + "@batch", + "source", + f"[{options}]", + "", + "[]", + ], + "source in aws batch.", + mono=mono, + ) + + +help_functions = { + "browse": help_browse, + "cat": help_cat, + "eval": help_eval, + "list": help_list, + "submit": help_submit, +} diff --git a/abcli/help/docker.py b/abcli/help/docker.py index 59bdfdeb..7f9e96c7 100644 --- a/abcli/help/docker.py +++ b/abcli/help/docker.py @@ -106,15 +106,12 @@ def help_seed( tokens: List[str], mono: bool, ) -> str: - options = "actions|repo" - return show_usage( [ - "@plugin", - "browse", - f"[{options}]", + "@docker", + "seed", ], - "browse blue_plugin.", + "seed docker 🌱.", mono=mono, ) diff --git a/abcli/help/functions.py b/abcli/help/functions.py index a1f46bd1..50d29333 100644 --- a/abcli/help/functions.py +++ b/abcli/help/functions.py @@ -1,3 +1,4 @@ +from abcli.help.aws_batch import help_functions as help_aws_batch from abcli.help.cp import help_cp from abcli.help.docker import help_functions as help_docker from abcli.help.download import help_download @@ -15,6 +16,7 @@ help_functions = { + "aws_batch": help_aws_batch, "cp": help_cp, "docker": help_docker, "download": help_download,