Skip to content

Commit

Permalink
feat!: remove s3 upload feature (#1095)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrePicosson authored Jun 9, 2022
1 parent 899f11e commit 39fcc37
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 146 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed

- BREAKING: drop the s3 upload feature (#1095)

## [0.17.0] 2022-06-07

### Added
Expand Down
1 change: 0 additions & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ psycopg2-binary==2.9.3
requests>=2.20.0
uwsgi==2.0.20
zxcvbn==4.4.28
boto3==1.24.0
grpcio==1.46.3
grpcio-tools==1.46.3
minio==7.1.8
Expand Down
19 changes: 1 addition & 18 deletions backend/substrapp/compute_tasks/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from substrapp.compute_tasks.context import Context
from substrapp.compute_tasks.directories import SANDBOX_DIR
from substrapp.compute_tasks.directories import TaskDirName
from substrapp.compute_tasks.transfer_bucket import TAG_VALUE_FOR_TRANSFER_BUCKET
from substrapp.compute_tasks.transfer_bucket import TRANSFER_BUCKET_TESTTUPLE_TAG
from substrapp.models.image_entrypoint import ImageEntrypoint

logger = structlog.get_logger(__name__)
Expand Down Expand Up @@ -53,10 +51,9 @@ def get_exec_command(ctx: Context, algo: Algo, is_testtuple_eval: bool) -> List[
if command[0].startswith("python"):
command.insert(1, "-u") # unbuffered. Allows streaming the logs in real-time.

env = _get_env(ctx, is_testtuple_eval)
args = _get_args(ctx, algo.key, is_testtuple_eval)

return env + command + args
return command + args


class TaskResource(dict):
Expand Down Expand Up @@ -199,17 +196,3 @@ def _get_args(ctx: Context, algo_key: str, is_testtuple_eval: bool) -> List[str]
logger.debug("Generated task command", command=command)

return command


def _get_env(ctx: Context, is_testtuple_eval: bool) -> List[str]:
"""This return environment variables for the task"""

env = []

# Transfer bucket
tag = ctx.task.get("tag")
if ctx.task_category == computetask_pb2.TASK_TEST and not is_testtuple_eval:
if tag and TAG_VALUE_FOR_TRANSFER_BUCKET in tag:
env.append(f"{TRANSFER_BUCKET_TESTTUPLE_TAG}={TAG_VALUE_FOR_TRANSFER_BUCKET}")

return env
106 changes: 0 additions & 106 deletions backend/substrapp/compute_tasks/transfer_bucket.py

This file was deleted.

11 changes: 0 additions & 11 deletions backend/substrapp/tasks/tasks_compute_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
from substrapp.compute_tasks.lock import MAX_TASK_DURATION
from substrapp.compute_tasks.lock import acquire_compute_plan_lock
from substrapp.compute_tasks.save_models import save_models
from substrapp.compute_tasks.transfer_bucket import TAG_VALUE_FOR_TRANSFER_BUCKET
from substrapp.compute_tasks.transfer_bucket import transfer_to_bucket
from substrapp.lock_local import lock_resource
from substrapp.orchestrator import get_orchestrator_client
from substrapp.utils import list_dir
Expand Down Expand Up @@ -226,8 +224,6 @@ def _run(self, channel_name: str, task, compute_plan_key): # noqa: C901
result["result"] = {"performances": {}}
for metric in ctx.metrics:
result["result"]["performances"][metric.key] = _get_perf(dirs, metric.key)

_transfer_model_to_bucket(ctx)
else:
logger.info("Saving models and local folder")
save_models(ctx)
Expand Down Expand Up @@ -271,13 +267,6 @@ def _prepare_chainkeys(compute_plan_dir: str, compute_plan_tag: str):
prepare_chainkeys_dir(chainkeys_dir, compute_plan_tag) # does nothing if chainkeys already populated


def _transfer_model_to_bucket(ctx: Context) -> None:
"""Export model to S3 bucket if the task has appropriate tag"""
if ctx.task["tag"] and TAG_VALUE_FOR_TRANSFER_BUCKET in ctx.task["tag"]:
logger.info("Task eligible to bucket export")
transfer_to_bucket(ctx)


def _store_failure(exc: Exception, compute_task_key: str) -> Optional[models.ComputeTaskFailureReport]:
"""If the provided exception is an `ExecutionError`, store its logs in the Django storage and in the database.
Otherwise, do nothing.
Expand Down
10 changes: 0 additions & 10 deletions backend/substrapp/tests/compute_tasks/test_transfer_bucket.py

This file was deleted.

0 comments on commit 39fcc37

Please sign in to comment.