Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash delivery - kamangir/bolt#746 #2

Merged
merged 6 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .abcli/actions.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .abcli/aka.sh

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ __pycache__
.DS_Store
*.egg-info
*.log
, .json
, .json
dist
5 changes: 5 additions & 0 deletions hubblescope/.abcli/abcli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env bash

abcli_source_path - caller,suffix=/tests

export hubble_module_name=hubblescope
6 changes: 6 additions & 0 deletions hubblescope/.abcli/actions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env bash

function hubble_action_git_before_push() {
[[ "$(abcli_git get_branch)" == "main" ]] &&
hubble pypi build
}
5 changes: 5 additions & 0 deletions hubblescope/.abcli/aka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env bash

function hubblescope() {
hubble "$@"
}
8 changes: 4 additions & 4 deletions .abcli/download.sh → hubblescope/.abcli/download.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env bash

function abcli_hubble_download() {
function hubble_download() {
local options=$1

if [ $(abcli_option_int "$options" help 0) == 1 ]; then
Expand All @@ -21,8 +21,8 @@ function abcli_hubble_download() {
local hubble_object_name=$(abcli_clarify_object "$2" . hubble_object)
local object_name=$(abcli_clarify_object "$3" .)

local auth=$(abcli_hubble_get auth $dataset_name)
local s3_uri=$(abcli_hubble_get s3_uri $dataset_name $hubble_object_name)
local auth=$(hubble_get auth $dataset_name)
local s3_uri=$(hubble_get s3_uri $dataset_name $hubble_object_name)

local command_line
if [ "$filename" == all ]; then
Expand Down Expand Up @@ -53,7 +53,7 @@ function abcli_hubble_download() {

[[ "$do_ingest" == 1 ]] &&
abcli_eval dryrun=$do_dryrun \
python3 -m hubble ingest \
python3 -m hubblescope ingest \
--dataset_name $dataset_name \
--hubble_object_name $hubble_object_name \
--object_name $object_name
Expand Down
4 changes: 2 additions & 2 deletions .abcli/get.sh → hubblescope/.abcli/get.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env bash

function abcli_hubble_get() {
python3 -m hubble get \
function hubble_get() {
python3 -m hubblescope get \
--what "$1" \
--dataset_name "$2" \
--object_name "$3" \
Expand Down
11 changes: 4 additions & 7 deletions .abcli/hubble.sh → hubblescope/.abcli/hubble.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
#! /usr/bin/env bash

function abcli_hubble() {
function hubble() {
local task=$(abcli_unpack_keyword $1 help)

if [ $task == "help" ]; then
abcli_hubble_download "$@"
abcli_hubble_list "$@"
abcli_hubble_select "$@"
hubble_download "$@"
hubble_list "$@"
hubble_select "$@"
return
fi

abcli_generic_task \
plugin=hubble,task=$task \
"${@:2}"
}

abcli_source_path \
$abcli_path_git/hubble/.abcli/tests
File renamed without changes.
12 changes: 6 additions & 6 deletions .abcli/list.sh → hubblescope/.abcli/list.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#! /usr/bin/env bash
function abcli_hubble_ls() {
abcli_hubble_list "$@"
function hubble_ls() {
hubble_list "$@"
}

function abcli_hubble_list() {
function hubble_list() {
local task=$1

if [ "$task" == help ]; then
Expand Down Expand Up @@ -40,7 +40,7 @@ function abcli_hubble_list() {
thing_type=object
thing_name=$abcli_hubble_object_name
suffix="${@:2}"
elif [[ $(abcli_hubble_is_dataset $thing_type) == 1 ]]; then
elif [[ $(hubble_is_dataset $thing_type) == 1 ]]; then
thing_type=dataset
thing_name=${1:-.}
suffix="${@:2}"
Expand All @@ -60,13 +60,13 @@ function abcli_hubble_list() {

abcli_log "🔭 $dataset_name :: $object_name"

local s3_uri=$(abcli_hubble_get s3_uri $dataset_name $object_name)
local s3_uri=$(hubble_get s3_uri $dataset_name $object_name)
[[ ! -z "$suffix" ]] && s3_uri=$s3_uri$suffix
abcli_log "🔗 $s3_uri"

# https://registry.opendata.aws/hst/
abcli_eval - \
"aws s3 ls \
$(abcli_hubble_get auth $dataset_name) \
$(hubble_get auth $dataset_name) \
$s3_uri"
}
12 changes: 6 additions & 6 deletions .abcli/select.sh → hubblescope/.abcli/select.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[[ -z "$abcli_hubble_dataset_name" ]] && export abcli_hubble_dataset_name=hst

function abcli_hubble_select() {
function hubble_select() {
if [ "$1" == help ]; then
abcli_show_usage "hubble select [dataset] <hubble-dataset-name>" \
"select <hubble-dataset-name>, example: hst."
Expand All @@ -18,7 +18,7 @@ function abcli_hubble_select() {
if [[ -z "$thing_type" ]]; then
abcli_log_error "-hubble: select: <object-name> not found."
return 1
elif [[ $(abcli_hubble_is_dataset $thing_type) == 1 ]]; then
elif [[ $(hubble_is_dataset $thing_type) == 1 ]]; then
local thing_type=dataset
local thing_name=$1
local args="${@:2}"
Expand All @@ -36,7 +36,7 @@ function abcli_hubble_select() {

abcli_log "🔗 https://registry.opendata.aws/$thing_name/"
abcli_log "🔗 https://github.com/awslabs/open-data-registry/blob/main/datasets/$thing_name.yaml"
abcli_log_file $(abcli_hubble_dataset_metadata $thing_name)
abcli_log_file $(hubble_dataset_metadata $thing_name)
else
abcli_log "🔭 $abcli_hubble_dataset_name :: $thing_name"

Expand All @@ -48,12 +48,12 @@ function abcli_hubble_select() {
"$args"
}

function abcli_hubble_dataset_metadata() {
function hubble_dataset_metadata() {
echo $abcli_path_git/open-data-registry/datasets/$1.yaml
}

function abcli_hubble_is_dataset() {
if [[ -f $(abcli_hubble_dataset_metadata $1) ]]; then
function hubble_is_dataset() {
if [[ -f $(hubble_dataset_metadata $1) ]]; then
echo 1
return
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ function test_hubble_is_dataset() {
local do_dryrun=$(abcli_option_int "$options" dryrun 0)

abcli_assert \
$(abcli_hubble_is_dataset hst) \
$(hubble_is_dataset hst) \
1

abcli_assert \
$(abcli_hubble_is_dataset nst) \
$(hubble_is_dataset nst) \
0

abcli_assert \
$(abcli_hubble_is_dataset shopping-humor-generation) \
$(hubble_is_dataset shopping-humor-generation) \
1
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hubblescope/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

DESCRIPTION = f"{ICON} tools to access and process Hubble Space Telescope imagery and other datasets on AWS Open Data Registry."

VERSION = "4.6.1"
VERSION = "4.16.1"
Loading