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

Merge CVAT milestone 2 changes #1746

Merged
merged 106 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
5e20c05
Fix job event handling when no assignments exist
zhiltsov-max Jan 25, 2024
4f453b2
Implement boxes from points task creation
zhiltsov-max Jan 25, 2024
2b3e8c5
Refactor cloud storage api
zhiltsov-max Jan 26, 2024
8b48620
Implement job downloading
zhiltsov-max Jan 26, 2024
1281277
Estimate max bbox
zhiltsov-max Jan 29, 2024
fffd19c
Little refactoring
zhiltsov-max Jan 29, 2024
585ef40
Copy some shared code from excor to recor
zhiltsov-max Jan 29, 2024
03ada68
Refactor task creation and export
zhiltsov-max Jan 29, 2024
f1ea9f9
Implement boxes from points validation
zhiltsov-max Jan 29, 2024
0dda989
Integrate SDK updates
zhiltsov-max Jan 30, 2024
9a21e5e
Merge branch 'zm/sdk-changes-for-cvat-oracles' into zm/points-to-boxe…
zhiltsov-max Jan 30, 2024
7078629
Fix escrow access
zhiltsov-max Jan 30, 2024
33e7cb4
[Exchange/Recoring oracles] Add GCS support
Marishka17 Feb 4, 2024
46601ae
Remove local dev mocks
zhiltsov-max Feb 9, 2024
2b321ce
Merge branch 'develop' into zm/points-to-boxes-task
zhiltsov-max Feb 9, 2024
ade7005
Remove some extra changes
zhiltsov-max Feb 9, 2024
c2429c3
Update tests
zhiltsov-max Feb 9, 2024
ad3ffc1
Update some tests
zhiltsov-max Feb 9, 2024
475401b
Remove extra launcher change
zhiltsov-max Feb 12, 2024
597be93
Refactor code
Marishka17 Feb 16, 2024
2efc778
Add google-cloud-storage dependency
Marishka17 Feb 19, 2024
2f7cab4
Merge branch 'zm/points-to-boxes-task' into mk/add_gcs_support
Marishka17 Feb 19, 2024
650dd69
Fix exception classes
Marishka17 Feb 19, 2024
37551a9
Set env variables in docker-compose.test.yml
Marishka17 Feb 19, 2024
52e3471
[CVAT] Points to boxes task (#1560)
zhiltsov-max Feb 20, 2024
bd43c84
Use virtual hosted bucket style
Marishka17 Feb 20, 2024
2c19863
Fix creating CS in CVAT
Marishka17 Feb 20, 2024
2d57d96
Fix tests
Marishka17 Feb 20, 2024
b056892
Merge branch 'cvat-milestone-2' into mk/add_gcs_support
Marishka17 Feb 20, 2024
21aa731
Add basic implementation for skeletons from boxes
zhiltsov-max Feb 1, 2024
adf4359
Refactor and fix some errors
zhiltsov-max Feb 2, 2024
6900a11
Implement job uploading
zhiltsov-max Feb 5, 2024
cd3dc98
Implement downloading
zhiltsov-max Feb 6, 2024
8722d53
Fix extra gt boxes in merged results from excor
zhiltsov-max Feb 7, 2024
5771d22
Implement skeleton matching
zhiltsov-max Feb 7, 2024
2e03d79
Fix labels in merged annotations
zhiltsov-max Feb 9, 2024
4d20ef7
Update project events handling in excor
zhiltsov-max Feb 9, 2024
54dd6b5
Improve oks sigma comment
zhiltsov-max Feb 9, 2024
642fc4c
Remove local testing assets
zhiltsov-max Feb 9, 2024
4ce71da
Fix label mapping
zhiltsov-max Feb 9, 2024
37a2381
Add extra skeleton validations in manifest
zhiltsov-max Feb 12, 2024
a7ee995
Update .env template
zhiltsov-max Feb 22, 2024
e2c034e
Update several comments
zhiltsov-max Feb 22, 2024
7c8d976
Fix failing tests
zhiltsov-max Feb 22, 2024
0b8648d
Update enum name
zhiltsov-max Feb 22, 2024
b8a82dc
Add more annotation validations for skeletons
zhiltsov-max Feb 12, 2024
b55879a
Extend input annotations validation
zhiltsov-max Feb 12, 2024
b2b2f93
Fix quality computation, refactor
zhiltsov-max Feb 13, 2024
0b2f557
Unify assignment accuracy checks between different job types
zhiltsov-max Feb 20, 2024
de09cbf
Refactor GT downloading for validation
zhiltsov-max Feb 20, 2024
a42b71b
Add gcs support - fixes (#1)
zhiltsov-max Feb 22, 2024
e6cea8e
Add job annotation mode param into assignment links
zhiltsov-max Feb 22, 2024
80d05c9
Add CD trigger for experimental cvat oracles
ivhus Feb 25, 2024
b69462a
Merge pull request #1562 from Marishka17/mk/add_gcs_support
zhiltsov-max Feb 26, 2024
005ae63
Merge branch 'cvat-milestone-2' into zm/boxes-to-skeletons-task
zhiltsov-max Feb 26, 2024
f211875
Update code formatting
zhiltsov-max Feb 26, 2024
5dc0c81
Fix test
zhiltsov-max Feb 26, 2024
4ad0d17
Format code
zhiltsov-max Feb 26, 2024
7e7f012
Fix bucket uses
zhiltsov-max Feb 26, 2024
5b2909c
Fix result sending
zhiltsov-max Feb 26, 2024
a30df48
Merge pull request #1578 from humanprotocol/zm/boxes-to-skeletons-task
zhiltsov-max Feb 26, 2024
77035fb
Merge branch 'zm/boxes-to-skeletons-task' into zm/new-tasks-extras
zhiltsov-max Feb 26, 2024
c3a6947
Merge pull request #1634 from humanprotocol/zm/new-tasks-extras
zhiltsov-max Feb 27, 2024
345cec8
Remove extra changes
zhiltsov-max Feb 27, 2024
80a0d66
Fix extra code
zhiltsov-max Feb 27, 2024
553cbc3
Merge branch 'cvat-milestone-2' into zm/new-results-validation
zhiltsov-max Feb 27, 2024
4e86b7f
Remove unused code
zhiltsov-max Feb 27, 2024
349ebaa
Align enum naming convention
zhiltsov-max Feb 28, 2024
cf3f1de
Merge pull request #1642 from humanprotocol/zm/refactor-enums
zhiltsov-max Feb 29, 2024
2e6c31a
Merge branch 'cvat-milestone-2' into zm/new-results-validation
zhiltsov-max Feb 29, 2024
66a49a8
Merge pull request #1635 from humanprotocol/zm/new-results-validation
zhiltsov-max Feb 29, 2024
854cbc7
Use relative paths in bucket in task creation
zhiltsov-max Mar 4, 2024
26c8c55
Improve error messages
zhiltsov-max Mar 4, 2024
019f040
Improve skeleton and bbox validation
zhiltsov-max Mar 4, 2024
8041d62
Fix escrow manifest downloading
zhiltsov-max Mar 5, 2024
b618f00
Update tests
zhiltsov-max Mar 5, 2024
77faa0c
Fix tests
zhiltsov-max Mar 5, 2024
a86dfe2
Merge pull request #1666 from humanprotocol/zm/fix-escrow-downloading-m2
zhiltsov-max Mar 6, 2024
2f8d7f9
Implement general image bans
zhiltsov-max Mar 8, 2024
57bd47a
Fix import
zhiltsov-max Mar 8, 2024
f88896d
Make default gt ban threshold more strict
zhiltsov-max Mar 11, 2024
6570d89
Fix comparison for absent points
zhiltsov-max Mar 11, 2024
6bf2aa8
Fix comparison for omitted points in jobs
zhiltsov-max Mar 11, 2024
4d88557
Finish escrows with too many unverifiable assignments
zhiltsov-max Mar 12, 2024
a8d220c
Merge pull request #1694 from humanprotocol/zm/fix-hidden-points-comp…
zhiltsov-max Mar 12, 2024
35dcb61
Merge branch 'cvat-milestone-2' into zm/gt-image-bans
zhiltsov-max Mar 12, 2024
a1cb001
Check if an increased healthcheck interval will fix unhealthy contain…
Dzeranov Mar 12, 2024
0d4e3d8
Merge pull request #1705 from humanprotocol/zm/fix-ro-tests
zhiltsov-max Mar 12, 2024
746bd3a
Merge branch 'cvat-milestone-2' into zm/gt-image-bans
zhiltsov-max Mar 12, 2024
b1c12be
Merge pull request #1708 from humanprotocol/zm/m2-experiment
zhiltsov-max Mar 19, 2024
6a2df89
Merge pull request #1683 from humanprotocol/zm/gt-image-bans
zhiltsov-max Mar 19, 2024
4445a84
Fix validations for boxes from points task creation
zhiltsov-max Mar 20, 2024
14f805f
Merge branch 'develop' into cvat-milestone-2
zhiltsov-max Mar 21, 2024
ecc93af
Clean code
zhiltsov-max Mar 22, 2024
cbc625b
disable roi estimation for unreliable cases
zhiltsov-max Mar 22, 2024
71cbf1a
Fix manifest parsing
zhiltsov-max Mar 22, 2024
8c9e6ac
Remove m0 launcher stubs
zhiltsov-max Mar 22, 2024
80ddca4
Remove m0 rep or stubs
zhiltsov-max Mar 22, 2024
ae17655
Make max assignment time optional in manifest
zhiltsov-max Mar 22, 2024
4f5b68e
Make label type fully optional in manifest
zhiltsov-max Mar 22, 2024
ef1b003
Merge pull request #1747 from humanprotocol/zm/m2-experiment
zhiltsov-max Mar 25, 2024
96463cf
Fix test
zhiltsov-max Mar 25, 2024
3fb0af3
Enable and fix a disabled m1 task creation test
zhiltsov-max Mar 25, 2024
5e49f0d
Merge pull request #1753 from humanprotocol/zm/m2-develop-merge
zhiltsov-max Mar 28, 2024
b6450d9
Fix RecOr tests
zhiltsov-max Mar 28, 2024
6ef3ccd
Merge pull request #1779 from humanprotocol/zm/fix-ro-tests
zhiltsov-max Mar 28, 2024
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/cd-cvat-exchange-oracle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Deploy CVAT Exchange Oracle

on:
push:
branches: [ develop, main ]
branches: [ develop, main, cvat-milestone-2 ]
paths:
- 'packages/examples/cvat/exchange-oracle/**'
pull_request:
branches: [ develop, main ]
branches: [ develop, main, cvat-milestone-2 ]
paths:
- 'packages/examples/cvat/exchange-oracle/**'
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-cvat-recording-oracle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Deploy CVAT Recording Oracle

on:
push:
branches: [ develop, main ]
branches: [ develop, main, cvat-milestone-2 ]
paths:
- 'packages/examples/cvat/recording-oracle/**'
pull_request:
branches: [ develop, main ]
branches: [ develop, main, cvat-milestone-2 ]
paths:
- 'packages/examples/cvat/recording-oracle/**'
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""non-unique-escrows

Revision ID: c1e74c227cfe
Revises: 16ecc586d685
Create Date: 2024-02-05 22:54:42.478270

"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils


# revision identifiers, used by Alembic.
revision = 'c1e74c227cfe'
down_revision = '16ecc586d685'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('projects_escrow_address_key', 'projects', type_='unique')
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint('projects_escrow_address_key', 'projects', ['escrow_address'])
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ services:
STORAGE_SECRET_KEY: 'devdevdev'
STORAGE_RESULTS_BUCKET_NAME: 'results'
STORAGE_USE_SSL: False
STORAGE_PROVIDER: 'aws'
ENABLE_CUSTOM_CLOUD_HOST: Yes
depends_on:
postgres:
Expand Down
266 changes: 264 additions & 2 deletions packages/examples/cvat/exchange-oracle/poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/examples/cvat/exchange-oracle/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ human-protocol-sdk = "^1.1.19"
xmltodict = "^0.13.0"
datumaro = {git = "https://github.com/cvat-ai/datumaro.git", rev = "ff83c00c2c1bc4b8fdfcc55067fcab0a9b5b6b11"}
boto3 = "^1.28.33"
google-cloud-storage = "^2.14.0"


[tool.poetry.group.dev.dependencies]
Expand Down
11 changes: 8 additions & 3 deletions packages/examples/cvat/exchange-oracle/src/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ PROCESS_RECORDING_ORACLE_WEBHOOKS_CHUNK_SIZE=
TRACK_COMPLETED_PROJECTS_INT=
TRACK_COMPLETED_PROJECTS_CHUNK_SIZE=
TRACK_COMPLETED_TASKS_INT=
RETRIEVE_ANNOTATIONS_INT=
RETRIEVE_ANNOTATIONS_CHUNK_SIZE=
TRACK_COMPLETED_ESCROWS_INT=
TRACK_COMPLETED_ESCROWS_CHUNK_SIZE=
PROCESS_JOB_LAUNCHER_WEBHOOKS_INT=
TRACK_CREATING_TASKS_INT=
REJECTED_PROJECTS_CHUNK_SIZE=
ACCEPTED_PROJECTS_CHUNK_SIZE=

# CVAT Config

Expand All @@ -50,12 +52,14 @@ CVAT_INCOMING_WEBHOOKS_URL=
CVAT_WEBHOOK_SECRET=
CVAT_ORG_SLUG=

# S3 Storage Config
# Storage Config (S3/GCS)

STORAGE_PROVIDER=
STORAGE_ENDPOINT_URL=
STORAGE_REGION=
STORAGE_ACCESS_KEY=
STORAGE_SECRET_KEY=
STORAGE_KEY_FILE_PATH=
STORAGE_RESULTS_BUCKET_NAME=
STORAGE_USE_SSL=

Expand All @@ -73,5 +77,6 @@ HUMAN_APP_SIGNATURE=

# Localhost

LOCALHOST_RECORDING_ORACLE_ADDRESS=
LOCALHOST_RECORDING_ORACLE_URL=
LOCALHOST_JOB_LAUNCHER_URL=
5 changes: 5 additions & 0 deletions packages/examples/cvat/exchange-oracle/src/chain/escrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from human_protocol_sdk.escrow import EscrowData, EscrowUtils
from human_protocol_sdk.storage import StorageUtils

from src.core.config import Config


def get_escrow(chain_id: int, escrow_address: str) -> EscrowData:
escrow = EscrowUtils.get_escrow(ChainId(chain_id), escrow_address)
Expand Down Expand Up @@ -51,4 +53,7 @@ def get_job_launcher_address(chain_id: int, escrow_address: str) -> str:


def get_recording_oracle_address(chain_id: int, escrow_address: str) -> str:
if address := Config.localhost.recording_oracle_address:
return address

return get_escrow(chain_id, escrow_address).recording_oracle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pydantic import BaseModel

ANNOTATION_METAFILE_NAME = "annotation_meta.json"
ANNOTATION_RESULTS_METAFILE_NAME = "annotation_meta.json"
RESULTING_ANNOTATIONS_FILE = "resulting_annotations.zip"


Expand Down
68 changes: 45 additions & 23 deletions packages/examples/cvat/exchange-oracle/src/core/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# pylint: disable=too-few-public-methods,missing-class-docstring
""" Project configuration from env vars """
import os
from typing import ClassVar, Optional

from attrs.converters import to_bool
from dotenv import load_dotenv

from src.utils.logging import parse_log_level
Expand All @@ -10,12 +12,6 @@
load_dotenv()


def str_to_bool(val: str) -> bool:
from distutils.util import strtobool

return val is True or strtobool(val)


class PostgresConfig:
port = os.environ.get("PG_PORT", "5432")
host = os.environ.get("PG_HOST", "0.0.0.0")
Expand Down Expand Up @@ -53,6 +49,8 @@ class LocalhostConfig:
addr = os.environ.get("LOCALHOST_MUMBAI_ADDR", "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266")

job_launcher_url = os.environ.get("LOCALHOST_JOB_LAUNCHER_URL")

recording_oracle_address = os.environ.get("LOCALHOST_RECORDING_ORACLE_ADDRESS")
recording_oracle_url = os.environ.get("LOCALHOST_RECORDING_ORACLE_URL")


Expand All @@ -75,8 +73,20 @@ class CronConfig:
track_assignments_int = int(os.environ.get("TRACK_ASSIGNMENTS_INT", 5))
track_assignments_chunk_size = os.environ.get("TRACK_ASSIGNMENTS_CHUNK_SIZE", 10)

retrieve_annotations_int = int(os.environ.get("RETRIEVE_ANNOTATIONS_INT", 60))
retrieve_annotations_chunk_size = os.environ.get("RETRIEVE_ANNOTATIONS_CHUNK_SIZE", 5)
track_completed_escrows_int = int(
# backward compatibility
os.environ.get(
"TRACK_COMPLETED_ESCROWS_INT", os.environ.get("RETRIEVE_ANNOTATIONS_INT", 60)
)
)
track_completed_escrows_chunk_size = os.environ.get(
# backward compatibility
"TRACK_COMPLETED_ESCROWS_CHUNK_SIZE",
os.environ.get("RETRIEVE_ANNOTATIONS_CHUNK_SIZE", 5),
)

rejected_projects_chunk_size = os.environ.get("REJECTED_PROJECTS_CHUNK_SIZE", 20)
accepted_projects_chunk_size = os.environ.get("ACCEPTED_PROJECTS_CHUNK_SIZE", 20)


class CvatConfig:
Expand All @@ -94,39 +104,51 @@ class CvatConfig:


class StorageConfig:
endpoint_url = os.environ.get("STORAGE_ENDPOINT_URL", "storage.googleapis.com")
region = os.environ.get("STORAGE_REGION", "")
access_key = os.environ.get("STORAGE_ACCESS_KEY", "")
secret_key = os.environ.get("STORAGE_SECRET_KEY", "")
results_bucket_name = os.environ.get("STORAGE_RESULTS_BUCKET_NAME", "")
secure = str_to_bool(os.environ.get("STORAGE_USE_SSL", "true"))
provider: ClassVar[str] = os.environ["STORAGE_PROVIDER"].lower()
data_bucket_name: ClassVar[str] = (
os.environ.get("STORAGE_RESULTS_BUCKET_NAME") # backward compatibility
or os.environ["STORAGE_BUCKET_NAME"]
)
endpoint_url: ClassVar[str] = os.environ[
"STORAGE_ENDPOINT_URL"
] # TODO: probably should be optional
region: ClassVar[Optional[str]] = os.environ.get("STORAGE_REGION")
results_dir_suffix: ClassVar[str] = os.environ.get("STORAGE_RESULTS_DIR_SUFFIX", "-results")
secure: ClassVar[bool] = to_bool(os.environ.get("STORAGE_USE_SSL", "true"))

# S3 specific attributes
access_key: ClassVar[Optional[str]] = os.environ.get("STORAGE_ACCESS_KEY")
secret_key: ClassVar[Optional[str]] = os.environ.get("STORAGE_SECRET_KEY")

# GCS specific attributes
key_file_path: ClassVar[Optional[str]] = os.environ.get("STORAGE_KEY_FILE_PATH")

@classmethod
def provider_endpoint_url(cls):
scheme = "https://" if cls.secure else "http://"
def get_scheme(cls) -> str:
return "https://" if cls.secure else "http://"

return f"{scheme}{cls.endpoint_url}"
@classmethod
def provider_endpoint_url(cls):
return f"{cls.get_scheme()}{cls.endpoint_url}"

@classmethod
def bucket_url(cls):
scheme = "https://" if cls.secure else "http://"

if is_ipv4(cls.endpoint_url):
return f"{scheme}{cls.endpoint_url}/{cls.results_bucket_name}/"
return f"{cls.get_scheme()}{cls.endpoint_url}/{cls.data_bucket_name}/"
else:
return f"{scheme}{cls.results_bucket_name}.{cls.endpoint_url}/"
return f"{cls.get_scheme()}{cls.data_bucket_name}.{cls.endpoint_url}/"


class FeaturesConfig:
enable_custom_cloud_host = str_to_bool(os.environ.get("ENABLE_CUSTOM_CLOUD_HOST", "no"))
enable_custom_cloud_host = to_bool(os.environ.get("ENABLE_CUSTOM_CLOUD_HOST", "no"))
"Allows using a custom host in manifest bucket urls"

default_export_timeout = int(os.environ.get("DEFAULT_EXPORT_TIMEOUT", 60))
"Timeout, in seconds, for annotations or dataset export waiting"


class CoreConfig:
default_assignment_time = int(os.environ.get("DEFAULT_ASSIGNMENT_TIME", 300))
default_assignment_time = int(os.environ.get("DEFAULT_ASSIGNMENT_TIME", 1800))


class HumanAppConfig:
Expand Down
Loading
Loading