-
Notifications
You must be signed in to change notification settings - Fork 3
distribution notebook #2243
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
Merged
Merged
distribution notebook #2243
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
24774f3
add marimo artifacts to gitignore
damonmcc 23312d6
add script to run distribution action
damonmcc 7222224
fix bytes filename typo
damonmcc 93df82b
add links to bytes and open data pages
damonmcc 9c7e1f1
refresh distribution notebook
damonmcc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,3 +164,8 @@ package-lock.yml | |
|
|
||
| # uv | ||
| uv.lock | ||
|
|
||
| # Marimo | ||
| marimo/_static/ | ||
| marimo/_lsp/ | ||
| __marimo__/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| #!/bin/bash | ||
| # Trigger GitHub Actions distribute workflow for a product | ||
| # See action workflow file: .github/workflows/distribute_socrata_from_bytes.yml | ||
| # Usage: dcp_distribute [product] [version] [--source <source>] [--datasets <d1,d2>] | ||
| # [--destination-tags <t1,t2>] [--destination-types <t1,t2>] | ||
| # [--publish] [--metadata-only] [--validate] [--dry-run] [--no-tail] | ||
|
|
||
| set -e | ||
|
|
||
| # Defaults | ||
| TAIL_LOGS=true | ||
| SOURCE="bytes" | ||
| DESTINATION_TYPES="open_data" | ||
| PUBLISH=false | ||
| METADATA_ONLY=false | ||
| VALIDATE=false | ||
| DRY_RUN=false | ||
| DATASETS="" | ||
| DESTINATION_TAGS="" | ||
|
|
||
| POSITIONAL=() | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --no-tail) | ||
| TAIL_LOGS=false | ||
| shift | ||
| ;; | ||
| --source) | ||
| SOURCE="$2" | ||
| shift 2 | ||
| ;; | ||
| --datasets) | ||
| DATASETS="$2" | ||
| shift 2 | ||
| ;; | ||
| --destination-tags) | ||
| DESTINATION_TAGS="$2" | ||
| shift 2 | ||
| ;; | ||
| --destination-types) | ||
| DESTINATION_TYPES="$2" | ||
| shift 2 | ||
| ;; | ||
| --publish) | ||
| PUBLISH=true | ||
| shift | ||
| ;; | ||
| --metadata-only) | ||
| METADATA_ONLY=true | ||
| shift | ||
| ;; | ||
| --validate) | ||
| VALIDATE=true | ||
| shift | ||
| ;; | ||
| --dry-run) | ||
| DRY_RUN=true | ||
| shift | ||
| ;; | ||
| *) | ||
| POSITIONAL+=("$1") | ||
| shift | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| PRODUCT="${POSITIONAL[0]:-${PRODUCT}}" | ||
| VERSION="${POSITIONAL[1]:-${VERSION}}" | ||
| BRANCH=$(git branch --show-current) | ||
|
|
||
| if [ -z "$PRODUCT" ]; then | ||
| echo "Error: PRODUCT must be set as env var or passed as first argument" | ||
| echo "Usage: dcp_distribute <product> <version> [options]" | ||
| echo " or: PRODUCT=pluto VERSION=25v1 dcp_distribute [options]" | ||
| echo "" | ||
| echo "Options:" | ||
| echo " --source <source> Source ID (default: bytes)" | ||
| echo " --datasets <d1,d2> Comma-separated list of datasets to push" | ||
| echo " --destination-tags <t1,t2> Comma-separated list of destination tags" | ||
| echo " --destination-types <t1,t2> Comma-separated list of destination types (default: open_data)" | ||
| echo " --publish Publish the Socrata Revision" | ||
| echo " --metadata-only Only push metadata (including attachments)" | ||
| echo " --validate Validate assembled dataset files" | ||
| echo " --dry-run Perform a dry run (will just list destinations)" | ||
| echo " --no-tail Do not tail workflow logs after dispatch" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$VERSION" ]; then | ||
| echo "Error: VERSION must be set as env var or passed as second argument" | ||
| echo "Usage: dcp_distribute <product> <version> [options]" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Triggering distribute workflow for:" | ||
| echo " Product: $PRODUCT" | ||
| echo " Version: $VERSION" | ||
| echo " Source: $SOURCE" | ||
| echo " Branch: $BRANCH" | ||
| [ -n "$DATASETS" ] && echo " Datasets: $DATASETS" | ||
| [ -n "$DESTINATION_TAGS" ] && echo " Destination tags: $DESTINATION_TAGS" | ||
| [ -n "$DESTINATION_TYPES" ] && echo " Destination types: $DESTINATION_TYPES" | ||
| [ "$PUBLISH" = true ] && echo " Publish: true" | ||
| [ "$METADATA_ONLY" = true ] && echo " Metadata only: true" | ||
| [ "$VALIDATE" = true ] && echo " Validate files: true" | ||
| [ "$DRY_RUN" = true ] && echo " Dry run: true" | ||
| echo "" | ||
|
|
||
| WORKFLOW_ARGS=( | ||
| --ref "$BRANCH" | ||
| -f product="$PRODUCT" | ||
| -f version="$VERSION" | ||
| -f source="$SOURCE" | ||
| -f destination_types="$DESTINATION_TYPES" | ||
| -f publish="$PUBLISH" | ||
| -f metadata_only="$METADATA_ONLY" | ||
| -f validate_dataset_files="$VALIDATE" | ||
| -f dry_run="$DRY_RUN" | ||
| ) | ||
|
|
||
| [ -n "$DATASETS" ] && WORKFLOW_ARGS+=(-f datasets="$DATASETS") | ||
| [ -n "$DESTINATION_TAGS" ] && WORKFLOW_ARGS+=(-f destination_tags="$DESTINATION_TAGS") | ||
|
|
||
| gh workflow run distribute_socrata_from_bytes.yml "${WORKFLOW_ARGS[@]}" | ||
|
|
||
| echo "" | ||
| echo "✓ Workflow dispatched!" | ||
| echo "" | ||
|
|
||
| # Wait a moment for the run to appear in the API | ||
| sleep 2 | ||
|
|
||
| # Get the most recent run for this workflow and branch | ||
| RUN_INFO=$(gh run list --workflow=distribute_socrata_from_bytes.yml --branch="$BRANCH" --limit 1 --json databaseId,url --jq '.[0]') | ||
| RUN_URL=$(echo "$RUN_INFO" | jq -r '.url') | ||
| RUN_ID=$(echo "$RUN_INFO" | jq -r '.databaseId') | ||
|
|
||
| if [ -n "$RUN_URL" ]; then | ||
| # Create clickable hyperlink using ANSI escape codes | ||
| echo -e "View run: \033]8;;${RUN_URL}\033\\${RUN_URL}\033]8;;\033\\" | ||
| if [ "$TAIL_LOGS" = true ]; then | ||
| echo "" | ||
| echo "Tailing logs..." | ||
| gh run watch "$RUN_ID" | ||
| fi | ||
| else | ||
| echo "View runs: gh run list --workflow=distribute_socrata_from_bytes.yml --branch=$BRANCH" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
37 changes: 24 additions & 13 deletions
37
notebooks/marimo/lifecycle/distribution/bytes_socrata_versions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC there was a typo on Bytes and this was right!