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

Fix/statement logs #747

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:

jobs:
build-frontend:
uses: exacaster/lighter/.github/workflows/build-frontend.yml@master
uses: ./.github/workflows/build-frontend.yml
build-java:
uses: exacaster/lighter/.github/workflows/build-java.yml@master
uses: ./.github/workflows/build-java.yml
38 changes: 38 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Clean Github container registry
on:
workflow_call: { }
pull_request:
types: [ closed ]

jobs:
clean-registry:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
runs-on: ubuntu-latest
strategy:
matrix:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to extract matrix to a single file ind include it on all workflows, that require it, if its possible.

include:
- spark_version: 3.3.3
hadoop_version: 3
- spark_version: 3.4.1
hadoop_version: 3
- spark_version: 3.5.0
hadoop_version: 3
steps:
- name: Base ref
run: |
LOWER_BRANCH=${{ github.event.pull_request.head.ref }}
SLUG_BRANCH=$(echo "$LOWER_BRANCH" | sed -e 's/[^a-zA-Z0-9]/-/g' -e 's/--/-/g')
echo "BASE_REF=$SLUG_BRANCH" >> $GITHUB_ENV
fi
pdambrauskas marked this conversation as resolved.
Show resolved Hide resolved
- name: Delete tag on PR close or merge
if: github.event_name == 'pull_request' && github.event.action == 'closed'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: ${{ github.repository }}
BASE_REF: ${{ env.BASE_REF }}
run: |
TAG_TO_DELETE=${IMAGE_NAME}:${BASE_REF}-spark${{ matrix.spark_version }}
TOKEN=$(echo "${TOKEN}" | awk '{print substr($0, 12)}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

curl -X DELETE -H "Authorization: token ${TOKEN}" -H "Accept: application/vnd.github.v3+json" "https://ghcr.io/v2/${IMAGE_NAME}/manifests/${TAG_TO_DELETE}"
20 changes: 18 additions & 2 deletions .github/workflows/publish-registry.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: Publish image to Github container registry
on:
workflow_call: { }
pull_request:
branches:
- master

jobs:
publish-registry:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -15,10 +21,20 @@ jobs:
- spark_version: 3.5.0
hadoop_version: 3
steps:
- name: Base ref
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "BASE_REF=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "pull_request" ]; then
LOWER_BRANCH=${{ github.event.pull_request.head.ref }}
SLUG_BRANCH=$(echo "$LOWER_BRANCH" | sed -e 's/[^a-zA-Z0-9]/-/g' -e 's/--/-/g')
echo "$SLUG_BRANCH"
echo "BASE_REF=$SLUG_BRANCH" >> $GITHUB_ENV
fi
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/build-push-action@v3
Expand All @@ -27,4 +43,4 @@ jobs:
build-args: |
SPARK_VERSION=${{ matrix.spark_version }}
HADOOP_VERSION=${{ matrix.hadoop_version }}
tags: ghcr.io/exacaster/lighter:${{ github.event.release.tag_name }}-spark${{ matrix.spark_version }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BASE_REF }}-spark${{ matrix.spark_version }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:

jobs:
build-frontend:
uses: exacaster/lighter/.github/workflows/build-frontend.yml@master
uses: ./.github/workflows/build-frontend.yml
build-java:
uses: exacaster/lighter/.github/workflows/build-java.yml@master
uses: ./.github/workflows/build-java.yml
publish-registry:
uses: exacaster/lighter/.github/workflows/publish-registry.yml@master
uses: ./.github/workflows/publish-registry.yml
needs: [ build-frontend, build-java ]
3 changes: 2 additions & 1 deletion server/src/main/resources/shell_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(self, globals) -> None:
def _error_response(self, error):
exc_type, exc_value, exc_tb = sys.exc_info()
return {
"content": {"text/plain": str(sys.stdout.getvalue()).rstrip()},
"error": type(error).__name__,
"message": str(error),
"traceback": traceback.format_exception(exc_type, exc_value, exc_tb),
Expand Down Expand Up @@ -144,8 +145,8 @@ def main():
log.info("Starting session loop")
try:
while True:
setup_output()
for command in controller.read():
setup_output()
log.debug(f"Processing command {command}")
result = handler.exec(command)
controller.write(command["id"], result)
Expand Down