class ApplyLargoSession extends Job implements ShouldQueue

Traits

InteractsWithQueue
Queueable
Dispatchable

Properties

string $queue

The queue to push this job to.

int $tries

Number of times to retry this job.

string $id

The job ID.

User $user

The user who submitted the Largo session.

array $dismissedImageAnnotations

Array of all dismissed image annotation IDs for each label.

array $changedImageAnnotations

Array of all changed image annotation IDs for each label.

array $dismissedVideoAnnotations

Array of all dismissed video annotation IDs for each label.

array $changedVideoAnnotations

Array of all changed video annotation IDs for each label.

bool $force

Whether to dismiss labels even if they were created by other users.

Methods

void
__construct(string $id, User $user, array $dismissedImageAnnotations, array $changedImageAnnotations, array $dismissedVideoAnnotations, array $changedVideoAnnotations, bool $force)

Create a new job instance.

void
handle()

Execute the job.

void
failed(Throwable|null $exception)

Handle a job failure.

void
cleanupJobId()

Remove the properties that indicate that a save Largo session is in progress.

handleImageAnnotations()

Process the image annotations.

handleVideoAnnotations()

Process the video annotations.

lockAnnotations(array $dismissed, array $changed, string $annotationModel)

Acquire row locks on all affected annotations in ascending ID order.

array
ignoreDeletedLabels(array $dismissed, array $changed)

Removes changes to annotations that should get a new label which no longer exists.

array
ignoreNullChanges(array $dismissed, array $changed)

Removes changes to annotations where the same label was dismissed than should be attached again later.

applyDismissedLabels(User $user, array $dismissed, bool $force, string $labelModel)

Detach annotation labels that were dismissed in a Largo session.

applyChangedLabels(User $user, array $changed, string $annotationModel, string $labelModel)

Attach annotation labels that were chosen in a Largo session.

deleteDanglingAnnotations(array $dismissed, array $changed, string $annotationModel)

Delete annotations that now have no more labels attached.

Details

at line 100
void __construct(string $id, User $user, array $dismissedImageAnnotations, array $changedImageAnnotations, array $dismissedVideoAnnotations, array $changedVideoAnnotations, bool $force)

Create a new job instance.

Parameters

string $id
User $user
array $dismissedImageAnnotations
array $changedImageAnnotations
array $dismissedVideoAnnotations
array $changedVideoAnnotations
bool $force

Return Value

void

at line 117
void handle()

Execute the job.

Return Value

void

at line 137
void failed(Throwable|null $exception)

Handle a job failure.

Parameters

Throwable|null $exception

Return Value

void

at line 146
protected void cleanupJobId()

Remove the properties that indicate that a save Largo session is in progress.

Return Value

void

at line 159
protected handleImageAnnotations()

Process the image annotations.

at line 181
protected handleVideoAnnotations()

Process the video annotations.

at line 218
protected lockAnnotations(array $dismissed, array $changed, string $annotationModel)

Acquire row locks on all affected annotations in ascending ID order.

This must happen before any annotation labels are inserted or deleted. The FK checks of the inserts take KEY SHARE locks on the annotations in arbitrary order. Two concurrent jobs could then deadlock when they try to lock the annotations for deletion later. Locking up front also serializes concurrent jobs that affect the same annotations for the whole sequence of changing labels, dismissing labels and deleting dangling annotations.

The locks are held until the transaction commits. While the job runs, labels can still be attached to the locked annotations but any other updates (e.g. changing the shape) or deletions of the annotations block until the job is finished.

Parameters

array $dismissed
array $changed
string $annotationModel

The annotation model class.

at line 245
protected array ignoreDeletedLabels(array $dismissed, array $changed)

Removes changes to annotations that should get a new label which no longer exists.

Parameters

array $dismissed
array $changed

Return Value

array

Containing 'dismissed' and 'changed'

at line 275
protected array ignoreNullChanges(array $dismissed, array $changed)

Removes changes to annotations where the same label was dismissed than should be attached again later.

Parameters

array $dismissed
array $changed

Return Value

array

at line 312
protected applyDismissedLabels(User $user, array $dismissed, bool $force, string $labelModel)

Detach annotation labels that were dismissed in a Largo session.

Parameters

User $user
array $dismissed
bool $force
string $labelModel

The annotation label model class.

at line 336
protected applyChangedLabels(User $user, array $changed, string $annotationModel, string $labelModel)

Attach annotation labels that were chosen in a Largo session.

Parameters

User $user
array $changed
string $annotationModel

The annotation model class.

string $labelModel

The annotation label model class.

at line 441
protected deleteDanglingAnnotations(array $dismissed, array $changed, string $annotationModel)

Delete annotations that now have no more labels attached.

Parameters

array $dismissed
array $changed
string $annotationModel

The annotation model class.