class PtpJob extends Job implements ShouldQueue

Traits

Batchable
InteractsWithQueue
Queueable
SerializesModels
Queueable
Dispatchable

Properties

protected string $tmpInputFile

File where the input data for the Python script will be kept

protected string $tmpImageInputFile

File where the image input data for the Python script will be kept

protected string $outputFile

File where result data from the Python conversion script will be stored

static int $imageChunkSize

Number of images to be processed per chunk

static int $insertChunkSize

Number of annotations to be inserted per chunk

protected bool $deleteWhenMissingModels

Ignore this job if the project or volume does not exist any more.

protected $annotatedFileColumns

List of columns of the CSV file

Methods

__construct(Volume $volume, User $user, string $jobId)

Job used for converting Point annotations to Polygons

void
handle()

Execute the job.

array
generateInputFile($chunk)

Generate the input File containing data for the execution of the job

void
generateImageInputFile(array $paths, array $images)

Generate the input file containing image id and path data

void
python()

Run the python script for Point to Polygon conversion

void
uploadConvertedAnnotations()

Upload the converted annotations to the DB

void
insertAnnotationChunk(array $annotations, array $annotationLabels)

Insert annotation in the DB

void
cleanupJob()

Cleanup the existing job from the Volumes attribute

void
cleanupFiles()

Cleanup the files that the job might have created

void
failed(Throwable|null $exception)

Cleanup the Job if failed

void
maybeDownloadCheckpoint($from, $to)

Download the checkpoint if not present

processNewAnnotations(array $a)

Generate annotation chunks for new annotations

iterateOverCsvFile(string $file)

Create a generator that iterates the lines of a CSV file containing annotation results from the PTP conversion.

getCsvFile(string $file)

Open A CSV file.

Details

at line 89
__construct(Volume $volume, User $user, string $jobId)

Job used for converting Point annotations to Polygons

Parameters

Volume $volume

Volume for the PTP Job

User $user

User starting the PtpJob

string $jobId

Uuid associated to the job

at line 110
void handle()

Execute the job.

Return Value

void

at line 134
array generateInputFile($chunk)

Generate the input File containing data for the execution of the job

Parameters

$chunk

Collection of images to process at a time

Return Value

array

at line 184
void generateImageInputFile(array $paths, array $images)

Generate the input file containing image id and path data

Parameters

array $paths

Array containing the paths to the images.

array $images

Array containing the images

Return Value

void

at line 202
protected void python()

Run the python script for Point to Polygon conversion

Return Value

void

at line 233
void uploadConvertedAnnotations()

Upload the converted annotations to the DB

Return Value

void

at line 281
protected void insertAnnotationChunk(array $annotations, array $annotationLabels)

Insert annotation in the DB

Parameters

array $annotations

Annotation to upload

array $annotationLabels

Annotation label to upload

Return Value

void

at line 309
void cleanupJob()

Cleanup the existing job from the Volumes attribute

Return Value

void

at line 322
void cleanupFiles()

Cleanup the files that the job might have created

Return Value

void

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

Cleanup the Job if failed

Parameters

Throwable|null $exception

Return Value

void

at line 345
protected void maybeDownloadCheckpoint($from, $to)

Download the checkpoint if not present

Parameters

$from

From where to download the checkpoint

$to

To where to download the checkpoint

Return Value

void

at line 364
protected processNewAnnotations(array $a)

Generate annotation chunks for new annotations

Parameters

array $a

Annotations to process

at line 382
protected Generator iterateOverCsvFile(string $file)

Create a generator that iterates the lines of a CSV file containing annotation results from the PTP conversion.

Parameters

string $file

CSV file to open

Return Value

Generator

at line 418
protected SplFileObject getCsvFile(string $file)

Open A CSV file.

Parameters

string $file

CSV file to open

Return Value

SplFileObject