Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6356904
Update version.json
ObadaS Sep 1, 2026
e75fd14
Merge pull request #2527 from codalab/Version-Bump
ObadaS Sep 1, 2026
4475bc8
add option to forbid the compute worker from pulling the competition …
Aug 3, 2026
78bcb0f
rename feature name
Sep 1, 2026
7c0899a
Merge pull request #2486 from codalab/never_pull_compeititon_image
wlln Sep 8, 2026
21ac827
packages bump via uv lock --upgrade; bump django 5.2.15 -> 5.2.16 (pa…
Aug 24, 2026
4e3c2af
rebase and update some packages via uv lock --upgrade
Aug 28, 2026
1ebe647
various packages upgrades with uv lock --upgrade
Sep 1, 2026
9b084c3
Merge pull request #2513 from codalab/packages_upgrades
Didayolo Sep 8, 2026
7b5d573
Add pagination to GET /api/competitions and fix participating_in leak
ihsaan-ullah Aug 7, 2026
ad07165
Merge pull request #2493 from codalab/competiitons_api
ObadaS Sep 8, 2026
f5d36b2
remove ram limit for site_worker
Aug 27, 2026
68b6a1c
update limit to 15 GB, same as default quota
Sep 8, 2026
781e9a4
Update docker-compose.yml
Didayolo Sep 8, 2026
84b4351
Merge pull request #2519 from codalab/docker_compose_site_worker_ram_…
Didayolo Sep 8, 2026
fc2e51b
queue creation error improved
ihsaan-ullah Aug 4, 2026
07c3a34
allow users to add collaborators to queues when the queue adding limi…
ihsaan-ullah Aug 8, 2026
c5f4ea2
Merge pull request #2489 from codalab/queue_creation
Didayolo Sep 8, 2026
0819aa5
Remove robot submissions and bot user feature
ihsaan-ullah Aug 10, 2026
bba3a75
Merge pull request #2499 from codalab/remove_robot
Didayolo Sep 9, 2026
26664e7
Fix migrations
Didayolo Sep 10, 2026
fdbd056
Merge pull request #2533 from codalab/fix_migrations
Didayolo Sep 10, 2026
e5ab806
privacy link updated
ihsaan-ullah Aug 22, 2026
aae5208
Merge pull request #2509 from codalab/privacy_link
Didayolo Sep 10, 2026
f0a6f99
Fix organization name not showing on leaderboard for multi-task compe…
ihsaan-ullah Aug 10, 2026
8c7c09e
Merge pull request #2498 from codalab/submit_as_organization
Didayolo Sep 10, 2026
17416df
Merge pull request #2487 from codalab/throttling
ihsaan-ullah Sep 10, 2026
f4ad7a4
restrict get_details to submission owner or admin
ihsaan-ullah Aug 29, 2026
31638df
Merge pull request #2525 from codalab/submission_detail_api
Didayolo Sep 10, 2026
09000e4
Switch to quay.io for mc and minio images (#2537)
ObadaS Sep 14, 2026
1c4b27a
Deny anonymous access to /api/submissions/ list and retrieve (#2536)
ihsaan-ullah Sep 14, 2026
bc930d6
Packages upgrade (#2535)
ObadaS Sep 15, 2026
ca2d885
Submission API: Enforce phase start/end window on submission creation…
ihsaan-ullah Sep 15, 2026
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
114 changes: 68 additions & 46 deletions compute_worker/compute_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def to_bool(val):
HUMAN_IN_THE_LOOP = (
get("HUMAN_IN_THE_LOOP", "false").lower() == "true"
)
COMPETITION_ALLOW_IMAGE_PULL = to_bool(get("COMPETITION_ALLOW_IMAGE_PULL", "True"))


# -----------------------------------------------
Expand Down Expand Up @@ -741,38 +742,55 @@ def _update_status(self, status, extra_information=None):
def _get_container_image(self, image_name):
logger.info("Running pull for image: {}".format(image_name))
retries, max_retries = (0, 3)
while retries < max_retries:
if Settings.COMPETITION_ALLOW_IMAGE_PULL:
while retries < max_retries:
try:
with Progress() as progress:
resp = client.pull(image_name, stream=True, decode=True)
for line in resp:
if isinstance(line, dict) and line.get("error"):
raise DockerImagePullException(line["error"])
show_progress(line, progress)
break # Break if the loop is successful to exit "with Progress() as progress"

except (docker.errors.APIError, Exception) as pull_error:
retries += 1
if retries >= max_retries:
logger.error(
"There was a problem pulling the image : " + str(pull_error)
)
# Prepare data to be sent to submissions api
docker_pull_fail_data = {
"type": "Docker_Image_Pull_Fail",
"error_message": pull_error,
"is_scoring": self.is_scoring,
}
# Send data to be written to ingestion logs
self._update_submission(docker_pull_fail_data)
# Send error through web socket to the frontend
asyncio.run(self._send_data_through_socket(str(pull_error)))
raise DockerImagePullException(
f"Pull for {image_name} failed! Check the logs for more information"
)
else:
logger.warning("Failed. Retrying in 5 seconds...")
time.sleep(5) # Wait 5 seconds before retrying
else:
logger.info("COMPETITION_ALLOW_IMAGE_PULL is set to False, using local image if it exists")
try:
with Progress() as progress:
resp = client.pull(image_name, stream=True, decode=True)
for line in resp:
if isinstance(line, dict) and line.get("error"):
raise DockerImagePullException(line["error"])
show_progress(line, progress)
break # Break if the loop is successful to exit "with Progress() as progress"

except (docker.errors.APIError, Exception) as pull_error:
retries += 1
if retries >= max_retries:
logger.error(
"There was a problem pulling the image : " + str(pull_error)
)
# Prepare data to be sent to submissions api
docker_pull_fail_data = {
"type": "Docker_Image_Pull_Fail",
"error_message": pull_error,
"is_scoring": self.is_scoring,
}
# Send data to be written to ingestion logs
self._update_submission(docker_pull_fail_data)
# Send error through web socket to the frontend
asyncio.run(self._send_data_through_socket(str(pull_error)))
raise DockerImagePullException(
f"Pull for {image_name} failed! Check the logs for more information"
)
if client.inspect_image(image_name):
logger.warning("Image found, continuing")
else:
logger.warning("Failed. Retrying in 5 seconds...")
time.sleep(5) # Wait 5 seconds before retrying
logger.error("Image not found, aborting")
except Exception as e:
raise DockerImagePullException(f"Pull for {image_name} failed! COMPETITION_ALLOW_IMAGE_PULL is set to False, make sure the image is available locally")
docker_pull_fail_data = {
"type": "Docker_Image_Pull_Fail",
"error_message": "COMPETITION_ALLOW_IMAGE_PULL set to False but image is not present locally",
"is_scoring": self.is_scoring,
}
self._update_submission(docker_pull_fail_data)


async def _send_data_through_socket(self, error_message):
"""
Expand Down Expand Up @@ -943,23 +961,27 @@ def _create_container(
# Creating container
# COMPETITION_CONTAINER_NETWORK_DISABLED: Disable or not the competition container access to Internet (False by default)
# HTTP and HTTPS proxy for the competition container if needed
container = client.create_container(
self.container_image,
name=container_name,
host_config=host_config,
detach=False,
volumes=volumes_host,
command=command,
working_dir="/app/program",
environment=[
"PYTHONUNBUFFERED=1",
"http_proxy=" + Settings.COMPETITION_CONTAINER_HTTP_PROXY,
"https_proxy=" + Settings.COMPETITION_CONTAINER_HTTPS_PROXY,
],
network_disabled=Settings.COMPETITION_CONTAINER_NETWORK_DISABLED,
)
try:
container = client.create_container(
self.container_image,
name=container_name,
host_config=host_config,
detach=False,
volumes=volumes_host,
command=command,
working_dir="/app/program",
environment=[
"PYTHONUNBUFFERED=1",
"http_proxy=" + Settings.COMPETITION_CONTAINER_HTTP_PROXY,
"https_proxy=" + Settings.COMPETITION_CONTAINER_HTTPS_PROXY,
],
network_disabled=Settings.COMPETITION_CONTAINER_NETWORK_DISABLED,
)

logger.debug("Created container: " + str(container))
logger.debug("Created container: " + str(container))
except Exception as e:
logger.error(f"Error {e}")
raise SubmissionException(str(e))

return container

Expand Down
Loading
Loading