Components

class grandchallenge.components.models.APIMethodChoices(*values)[source]
class grandchallenge.components.models.ComponentImage(*args, **kwargs)[source]
Parameters:

Relationship fields:

Parameters:
class GPUTypeChoices(*values)
class ImportStatusChoices(*values)
property original_repo_tag

The tag of this image in the container repository

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class grandchallenge.components.models.ComponentInterface(id, overlay_segments, look_up_table, title, slug, description, default_value, schema, kind, relative_path, store_in_database)[source]
Parameters:
  • id (AutoField) – Primary key: ID

  • overlay_segments (JSONField) – Overlay segments. The schema that defines how categories of values in the overlay images are differentiated. Example usage: [{“name”: “background”, “visible”: true, “voxel_value”: 0},{“name”: “tissue”, “visible”: true, “voxel_value”: 1}]. If a categorical overlay is shown, it is possible to show toggles to change the visibility of the different overlay categories. To do so, configure the categories that should be displayed. For example: [{“name”: “Level 0”, “visible”: false, “voxel_value”: 0].

  • title (CharField) – Title. Human readable name of this input/output field.

  • slug (AutoSlugField) – Slug

  • description (TextField) – Description. Description of this input/output field.

  • default_value (JSONField) – Default value. Default value for this field, only valid for inputs.

  • schema (JSONField) – Schema. Additional JSON schema that the values for this interface must satisfy. See https://json-schema.org/. Only Draft 7, 6, 4 or 3 are supported.

  • kind (CharField) – Kind. What is the type of this interface? Used to validate interface values and connections between components.

  • relative_path (CharField) – Relative path. The path to the entity that implements this interface relative to the input or output directory.

  • store_in_database (BooleanField) – Store in database. Should the value be saved in a database field, only valid for outputs.

Relationship fields:

Parameters:

look_up_table (ForeignKey to LookUpTable) – Look up table. The look-up table that is applied when an overlay image is first shown (related name: componentinterface)

Reverse relationships:

Parameters:
  • additional_eval_inputs (Reverse ManyToManyField from Phase) – All additional eval inputs of this component interface (related name of additional_evaluation_inputs)

  • eval_outputs (Reverse ManyToManyField from Phase) – All eval outputs of this component interface (related name of evaluation_outputs)

  • phaseadditionalevaluationinput (Reverse ForeignKey from PhaseAdditionalEvaluationInput) – All phase additional evaluation inputs of this component interface (related name of socket)

  • phaseevaluationoutput (Reverse ForeignKey from PhaseEvaluationOutput) – All phase evaluation outputs of this component interface (related name of socket)

  • inputs (Reverse ManyToManyField from AlgorithmInterface) – All inputs of this component interface (related name of inputs)

  • outputs (Reverse ManyToManyField from AlgorithmInterface) – All outputs of this component interface (related name of outputs)

  • algorithminterfaceinput (Reverse ForeignKey from AlgorithmInterfaceInput) – All algorithm interface inputs of this component interface (related name of input)

  • algorithminterfaceoutput (Reverse ForeignKey from AlgorithmInterfaceOutput) – All algorithm interface outputs of this component interface (related name of output)

  • example_value (Reverse OneToOneField from ComponentInterfaceExampleValue) – The example value of this component interface (related name of interface)

  • componentinterfacevalue (Reverse ForeignKey from ComponentInterfaceValue) – All component interface values of this component interface (related name of interface)

  • question (Reverse ForeignKey from Question) – All questions of this component interface (related name of interface)

exception DoesNotExist
Kind

alias of InterfaceKindChoices

exception MultipleObjectsReturned
SuperKind

alias of InterfaceSuperKindChoices

property allowed_file_types

The allowed file types of the interface that is relevant when uploading

clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

property file_extension

The dot filename extension (e.g. ‘.jpg’) of an interface that is relevant when writing

property has_json_kind_example

Whether this socket has an example value for json kinds. This also accounts for example values with None or False values.

validate_against_schema(*, value)[source]

Validates values against both default and custom schemas

class grandchallenge.components.models.ComponentInterfaceExampleValue(id, created, modified, interface, value, extra_info)[source]
Parameters:

Relationship fields:

Parameters:

interface (OneToOneField to ComponentInterface) – Interface (related name: example_value)

exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

class grandchallenge.components.models.ComponentInterfaceValue(*args, **kwargs)[source]

Encapsulates the value of an interface at a certain point in the graph.

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
  • evaluation_evaluations_as_input (Reverse ManyToManyField from Evaluation) – All evaluation evaluations as input of this component interface value (related name of inputs)

  • evaluation_evaluations_as_output (Reverse ManyToManyField from Evaluation) – All evaluation evaluations as output of this component interface value (related name of outputs)

  • algorithms_jobs_as_input (Reverse ManyToManyField from Job) – All algorithms jobs as input of this component interface value (related name of inputs)

  • algorithms_jobs_as_output (Reverse ManyToManyField from Job) – All algorithms jobs as output of this component interface value (related name of outputs)

  • archive_items (Reverse ManyToManyField from ArchiveItem) – All archive items of this component interface value (related name of values)

  • display_sets (Reverse ManyToManyField from DisplaySet) – All display sets of this component interface value (related name of values)

  • download (Reverse ForeignKey from Download) – All downloads of this component interface value (related name of component_interface_value)

exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

property decompress

Should the CIV be decompressed?

This is only for legacy support of zip file submission for prediction evaluation. We should not support this anywhere else as it clobbers the input directory.

image_file
save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class grandchallenge.components.models.ComponentJob(*args, **kwargs)[source]
Parameters:
  • id (UUIDField) – Primary key: Id

  • created (DateTimeField) – Created

  • modified (DateTimeField) – Modified

  • status (PositiveSmallIntegerField) – Status

  • attempt (PositiveSmallIntegerField) – Attempt

  • stdout (TextField) – Stdout

  • stderr (TextField) – Stderr

  • exec_duration (DurationField) – Exec duration. The duration of the execution, if measured. Excludes data validation, container pulling, model downloading, data downloading and data uploading times. Includes model loading time, input data loading time, processing time, output data writing time and any delays from shared hardware issues.

  • invoke_duration (DurationField) – Invoke duration. The duration of the invocation, if measured. Excludes data validation, container pulling, model downloading, data downloading and data uploading times. Potentially excludes model loading time, depending on the users implementation. Includes input data loading time, processing time, output data writing time and any delays from shared hardware issues.

  • runtime_metrics (JSONField) – Runtime metrics

  • error_message (CharField) – Error message

  • detailed_error_message (JSONField) – Detailed error message

  • input_prefixes (JSONField) – Input prefixes. Map of the ComponentInterfaceValue id to the path prefix to use for this input, e.g. {‘1’: ‘foo/bar/’} will place CIV 1 at /input/foo/bar/<relative_path>

  • signing_key (BinaryField) – Signing key. The key used to sign the inference result file

  • task_on_success (JSONField) – Task on success. Serialized task that is run on job success

  • task_on_failure (JSONField) – Task on failure. Serialized task that is run on job failure

  • time_limit (PositiveIntegerField) – Time limit. Time limit for the job in seconds

  • requires_gpu_type (CharField) – Requires gpu type. What GPU is required by this job?

  • requires_memory_gb (PositiveSmallIntegerField) – Requires memory gb. How much main memory (DRAM) is required by this job?

  • use_warm_pool (BooleanField) – Use warm pool. Whether to use warm pools

Relationship fields:

Parameters:
property container: ComponentImage

Returns the container object associated with this instance, which should be a foreign key to an object that is a subclass of ComponentImage

property output_interfaces: QuerySet

Returns an unevaluated QuerySet for the output interfaces

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class grandchallenge.components.models.ComponentJobManager(model=None, query=None, using=None, hints=None)[source]
only_completed()[source]

Jobs that are in their final state

static retrieve_existing_civs(*, civ_data_objects)[source]

Check if there are existing CIVs for the provided data and returns those.

Parameters:

civ_data_objects – A list of CIVData objects.

Returns:

A list of ComponentInterfaceValues

class grandchallenge.components.models.ImportStatusChoices(*values)[source]
class grandchallenge.components.models.InterfaceKindChoices(*values)[source]

Interface kind choices.

class grandchallenge.components.models.InterfaceKinds(*values)[source]

Interface kind sets.

class grandchallenge.components.models.InterfaceSuperKindChoices(*values)[source]
class grandchallenge.components.models.OverlaySegmentsMixin(*args, **kwargs)[source]
Parameters:

overlay_segments (JSONField) – Overlay segments. The schema that defines how categories of values in the overlay images are differentiated. Example usage: [{“name”: “background”, “visible”: true, “voxel_value”: 0},{“name”: “tissue”, “visible”: true, “voxel_value”: 1}]. If a categorical overlay is shown, it is possible to show toggles to change the visibility of the different overlay categories. To do so, configure the categories that should be displayed. For example: [{“name”: “Level 0”, “visible”: false, “voxel_value”: 0].

Relationship fields:

Parameters:

look_up_table (ForeignKey to LookUpTable) – Look up table. The look-up table that is applied when an overlay image is first shown

class grandchallenge.components.models.SourceChoices(*values)[source]
class grandchallenge.components.models.Tarball(*args, **kwargs)[source]
Parameters:

Relationship fields:

Parameters:
class ImportStatusChoices(*values)
save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.