Skip to content

Commit

Permalink
Merge pull request #1685 from codalab/develop
Browse files Browse the repository at this point in the history
* participants and submissions count fileds added to competition modal, use these counts in the competition detail page, public competitions page, home page popular competitions

* unused import removed - flake8

* Remove useless comments

* Update example_submission.py

While I was trying to use the robot submission, I had to add the file_size in the payload in order to achieve a robot submission

* tests added for submissions and participants counts

* commented the failing chahub tests (to be removed later)

* default participants count set to 1, script added to update counts for all competitions

* tests updated for the default participants count

* submission count fixed for multi-task competitions, updated delete multiple function to trigger modal's delete method, updated count script to count only parent submissions

* Optimization `PR#1` - Featured competitions (#1678)

* Featured field added in competition

* spelling fixed in comment

* Merge migrations from PR1 and PR2

---------

Co-authored-by: Adrien Pavão <[email protected]>

* twisted_certifi_requests (#1672)

* twisted_certifi_requests

* poetry update

---------

Co-authored-by: Ihsan Ullah <[email protected]>
Co-authored-by: Nicolas Homberg <[email protected]>
Co-authored-by: Benjamin Bearce <[email protected]>
  • Loading branch information
4 people authored Dec 3, 2024
2 parents 7b907be + d4ad8a1 commit 8891697
Show file tree
Hide file tree
Showing 24 changed files with 949 additions and 595 deletions.
45 changes: 29 additions & 16 deletions .github/workflows/release-version-update.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Update version.json and create PR

# Trigger the github action when a new release is published
on:
release:
types: [published]
Expand All @@ -9,50 +10,62 @@ jobs:
runs-on: ubuntu-latest

steps:

# Step 1: Checkout repository
- name: Checkout repository
uses: actions/checkout@v3

# Step 2: Get latest release version information
- name: Get release information
id: get_release
run: |
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
echo "$response" | jq '.tag_name, .name, .published_at, .body, .html_url' | tee /tmp/release_info
echo "::set-output name=tag_name::$(echo "$response" | jq -r .tag_name)"
echo "::set-output name=name::$(echo "$response" | jq -r .name)"
echo "::set-output name=published_at::$(echo "$response" | jq -r .published_at)"
echo "::set-output name=body::$(echo "$response" | jq -r .body)"
echo "::set-output name=html_url::$(echo "$response" | jq -r .html_url)"
echo "tag_name=$(echo "$response" | jq -r .tag_name)" >> $GITHUB_ENV
echo "name=$(echo "$response" | jq -r .name)" >> $GITHUB_ENV
echo "published_at=$(echo "$response" | jq -r .published_at)" >> $GITHUB_ENV
echo "body=$(echo "$response" | jq -r .body)" >> $GITHUB_ENV
echo "html_url=$(echo "$response" | jq -r .html_url)" >> $GITHUB_ENV
# Step 3: Update version.json file with latest information
- name: Update version.json
run: |
echo '{
"tag_name": "${{ steps.get_release.outputs.tag_name }}",
"release_name": "${{ steps.get_release.outputs.name }}",
"published_at": "${{ steps.get_release.outputs.published_at }}",
"body": "${{ steps.get_release.outputs.body }}"
"html_url": "${{ steps.get_release.outputs.html_url }}"
"tag_name": "${{ env.tag_name }}",
"release_name": "${{ env.name }}",
"published_at": "${{ env.published_at }}",
"body": "${{ env.body }}",
"html_url": "${{ env.html_url }}"
}' > version.json
# Step 4: Configure a user to create a branch and then push changes
- name: Configure Git user
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
# Step 5: Create a new branch for version updates
- name: Create new branch
run: |
git checkout -b update-version-${{ steps.get_release.outputs.tag_name }}
git checkout -b update-version-${{ env.tag_name }}
git add version.json
git commit -m "Update version.json for release ${{ steps.get_release.outputs.tag_name }}"
git commit -m "Update version.json for release ${{ env.tag_name }}"
# Step 6: Push branch
- name: Push branch
run: |
git push origin update-version-${{ steps.get_release.outputs.tag_name }}
git push origin update-version-${{ env.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Step 7: Create a pull request from the pushed branch
- name: Create Pull Request
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls \
-d '{
"title": "Update version.json for release ${{ steps.get_release.outputs.tag_name }}",
"title": "Update version.json for release ${{ env.tag_name }}",
"body": "This PR updates version.json with the latest release information.",
"head": "update-version-${{ steps.get_release.outputs.tag_name }}",
"head": "update-version-${{ env.tag_name }}",
"base": "develop"
}'
174 changes: 141 additions & 33 deletions compute_worker/poetry.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions compute_worker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ name = "compute-worker"
version = "0.1.0"
description = ""
authors = ["codalab"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
celery = "4.4.0"
requests = "2.20.0"
requests = "^2.20.0"
watchdog = "2.1.1"
argh = "0.26.2"
websockets = "8.1"
Expand Down
7 changes: 6 additions & 1 deletion docs/example_scripts/example_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# ----------------------------------------------------------------------------
from urllib.parse import urljoin # noqa: E402
import requests # noqa: E402,E261 # Ignore E261 to line up these noqa

import os

# Check someone updated PHASE_ID argument!
assert PHASE_ID, "PHASE_ID must be set at the top of this script"
Expand All @@ -68,11 +68,16 @@
print(f"Failed to create submission: {resp.json()['reason']}")
exit(-2)



file_size = os.path.getsize(SUBMISSION_ZIP_PATH)

# Create + Upload our dataset
datasets_url = urljoin(CODALAB_URL, '/api/datasets/')
datasets_payload = {
"type": "submission",
"request_sassy_file_name": "submission.zip",
"file_size": file_size,
}
resp = requests.post(datasets_url, datasets_payload, headers=headers)
if resp.status_code != 201:
Expand Down
Loading

0 comments on commit 8891697

Please sign in to comment.