Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed Nov 4, 2024
1 parent f08eb9d commit d246991
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
6 changes: 6 additions & 0 deletions abcli/.abcli/tests/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 " \
Expand Down
2 changes: 1 addition & 1 deletion abcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions abcli/config.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions abcli/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")
156 changes: 156 additions & 0 deletions abcli/help/aws_batch.py
Original file line number Diff line number Diff line change
@@ -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=<job-id>,log"

usage_1 = show_usage(
[
"@batch",
"browse",
f"[{options}]",
],
"browse <job-id>.",
mono=mono,
)

# ---
options = "queue=<queue-name>,status=<status>"

usage_2 = show_usage(
[
"@batch",
"browse",
f"[{options}]",
],
"browse <queue-name>.",
{
"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}]",
"<job-id>",
],
"cat <job-id>.",
mono=mono,
)


def help_eval(
tokens: List[str],
mono: bool,
) -> str:
options = "cat,dryrun,name=<job-name>"

return show_usage(
[
"@batch",
"eval",
f"[{options}]",
"<command-line>",
],
"eval <command-line> in aws batch.",
mono=mono,
)


def help_list(
tokens: List[str],
mono: bool,
) -> str:
options = "".join(
[
"~count",
xtra(
",dryrun,prefix=<prefix>,status=<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=<job-name>"

return show_usage(
[
"@batch",
"source",
f"[{options}]",
"<script-name>",
"[<args>]",
],
"source <script-name> in aws batch.",
mono=mono,
)


help_functions = {
"browse": help_browse,
"cat": help_cat,
"eval": help_eval,
"list": help_list,
"submit": help_submit,
}
9 changes: 3 additions & 6 deletions abcli/help/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
2 changes: 2 additions & 0 deletions abcli/help/functions.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,6 +16,7 @@


help_functions = {
"aws_batch": help_aws_batch,
"cp": help_cp,
"docker": help_docker,
"download": help_download,
Expand Down

0 comments on commit d246991

Please sign in to comment.