Skip to content

Commit 95a80c1

Browse files
committed
[Exchnage oracle] Pass job start/stop frame from Ex oracle to Rec oracle
1 parent 24bbc5a commit 95a80c1

File tree

7 files changed

+14
-5
lines changed

7 files changed

+14
-5
lines changed

packages/examples/cvat/exchange-oracle/src/core/annotation_meta.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class JobMeta(BaseModel):
1212
annotation_filename: Path
1313
annotator_wallet_address: str
1414
assignment_id: str
15+
start_frame: int
16+
stop_frame: int
1517

1618

1719
class AnnotationMeta(BaseModel):

packages/examples/cvat/exchange-oracle/src/crons/cvat/state_trackers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ def track_task_creation(logger: logging.Logger, session: Session) -> None:
186186
upload.task_id,
187187
upload.task.cvat_project_id,
188188
status=JobStatuses(cvat_job.state),
189+
start_frame=cvat_job.start_frame,
190+
stop_frame=cvat_job.stop_frame,
189191
)
190192

191193
completed.append(upload)

packages/examples/cvat/exchange-oracle/src/handlers/completed_escrows.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def _export_escrow_annotations(
7575
jobs = cvat_service.get_jobs_by_escrow_address(session, escrow_address, chain_id)
7676

7777
annotation_format = CVAT_EXPORT_FORMAT_MAPPING[manifest.annotation.type]
78+
# FUTURE-TODO: probably can be removed in the future since
79+
# these annotations are no longer used in Recording Oracle
7880
job_annotations = _download_job_annotations(logger, annotation_format, jobs)
7981

8082
if manifest.annotation.type == TaskTypes.image_skeletons_from_boxes.value:

packages/examples/cvat/exchange-oracle/src/handlers/cvat_events.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def handle_create_job_event(payload: dict) -> None:
123123
payload.job["task_id"],
124124
payload.job["project_id"],
125125
status=JobStatuses[payload.job["state"]],
126+
start_frame=payload.job["start_frame"],
127+
stop_frame=payload.job["stop_frame"],
126128
)
127129
cvat_service.touch(session, models.Job, [job_id])
128130

packages/examples/cvat/exchange-oracle/src/handlers/job_creation.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ def build(self):
354354
user_guide=manifest.annotation.user_guide,
355355
)
356356

357-
# TODO: setup webhook after task is created and GT job is configured
358357
# Setup webhooks for a project (update:task, update:job)
359358
cvat_webhook = cvat_api.create_cvat_webhook(cvat_project.id)
360359

@@ -401,7 +400,7 @@ def build(self):
401400
)
402401
db_service.get_task_by_id(session, task_id, for_update=True) # lock the row
403402

404-
# The task is fully created once 'update:task' or 'update:job' webhook is received.
403+
# The task is fully created once 'update:task' webhook is received.
405404
cvat_api.put_task_data(
406405
cvat_task.id,
407406
cloud_storage.id,
@@ -2640,7 +2639,6 @@ def _task_params_label_key(ts):
26402639
# TODO: improve guide handling - split for different points
26412640
)
26422641

2643-
# FIXME: setup webhook after GT job is created
26442642
# Setup webhooks for a project (update:task, update:job)
26452643
cvat_webhook = cvat_api.create_cvat_webhook(cvat_project.id)
26462644

@@ -2683,8 +2681,7 @@ def _task_params_label_key(ts):
26832681
)
26842682
db_service.get_task_by_id(session, task_id, for_update=True) # lock the row
26852683

2686-
# The task is fully created once 'update:task' or 'update:job'
2687-
# webhook is received.
2684+
# The task is fully created once 'update:task' webhook is received.
26882685
cvat_api.put_task_data(
26892686
cvat_task.id,
26902687
cvat_cloud_storage.id,

packages/examples/cvat/exchange-oracle/src/handlers/job_export.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def prepare_annotation_metafile(
5757
annotator_wallet_address=job.latest_assignment.user_wallet_address,
5858
assignment_id=job.latest_assignment.id,
5959
task_id=job.cvat_task_id,
60+
start_frame=job.start_frame,
61+
stop_frame=job.stop_frame,
6062
)
6163
for job in jobs
6264
]

packages/examples/cvat/exchange-oracle/src/models/cvat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ class Job(ChildOf[Task]):
194194
status = Column(String, Enum(JobStatuses), nullable=False)
195195
created_at = Column(DateTime(timezone=True), server_default=func.now())
196196
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
197+
start_frame = Column(Integer) # TODO: nullable=False
198+
stop_frame = Column(Integer) # TODO: nullable=False
197199

198200
task: Mapped[Task] = relationship(back_populates="jobs")
199201
project: Mapped[Project] = relationship(back_populates="jobs")

0 commit comments

Comments
 (0)