Variants Batch

class genomcore.controllers.variantsBatch.VariantsBatchController(*args, **kwargs)

Bases: VariantsController

COMPLETE = 'completed'
PENDING = 'pending'
FAILED = 'failed'
property BatchsId

This property return a list with all BatchId created

property get_errors

This property return a dict with errors inside observations The key of dict is the index in observations.

property errors

This property return the errors count

property total

This property return total observations inserted correctly

property status

This property return ‘completed’ if all observations was inserted and return ‘failed’ if not

get_status(observationBatchId)

Query the status of the one observationBatchId.

Parameters:

observationBatchId – Its a string, this argument is the identifier of transaction

Returns:

Transaction status.

{

‘id’: ‘67ffd46f709f4a3c230dfe02’, ‘projectId’: 550, ‘observationsTotal’: <Total number of observations in the batch>, ‘observationsCreatedTotal’: <Number of successfully created observations>, ‘observationsValidationFailedTotal’: <Number of observations that failed validation>, ‘observationsValidationFailed’: <List of observations that failed validation with detailed errors>, ‘observationsFailedTotal’: <Number of observations that failed to create>, ‘observationsFailed’: <List of observations that failed with their error messages>, ‘createdAt’: ‘2025-04-16T16:01:51.276Z’, ‘updatedAt’: ‘2025-04-16T16:01:51.344Z’, ‘status’: <string with the status: COMPLETED, FAILED, PENDING>

}

Return type:

dict

wait(sleep=30, log_proccesed=10)

This function put a semaphore for waiting all chunks was finished.

Parameters:
  • sleep – The method sleep 30 seconds by default if find one batch in pending status

  • log_proccesed – Print log_proccesed lines, by default print 10

create_one_observations_batch(observations: List[dict], retries: int | None = 0) int

Save many genetic variant observations in a queue Kafka without make chunks. Also this method dont wait to kafka finished all insertions

Parameters:
  • observations (list) – list of observations to save.

  • retries (int, optional) – number of retries in case of failure. Defaults to 3.

Returns:

Total chunks created.

Return type:

int

create_observations_batch(observations: List[dict], chunksize: int | None = 1000, retries: int | None = 0) int

Save many genetic variant observations in a queue Kafka.

Parameters:
  • observations (list) – list of observations to save.

  • chunksize (int, optional) – size of the chunks to send. Defaults to 100000.

  • retries (int, optional) – number of retries in case of failure. Defaults to 3.

Returns:

Total chunks created.

Return type:

int

__annotations__ = {}
__firstlineno__ = 11
__static_attributes__ = ('BatchId', '_errors', '_errors_description', '_ok', '_rel_batchId_groupId')