mxcubecore.queuelib.models

Pydantic models for the queue client wire format.

See JSON_FORMAT.md in this package for the full JSON format documentation

Functions

build_task_node_model(value)

normalize_mesh_range(value)

validate_model_tolerant(model_cls, data)

Validate <data> against <model_cls>, tolerating unknown fields.

validate_path(path)

Validate a path without requiring it to exist.

validate_position(value)

validate_safe_string(value, field_name)

validate_safe_template_prefix(value)

validate_safe_template_subdir(value)

Classes

CharacterisationNodeModel(*[, type, ...])

CharacterisationParameters(*[, shape, ...])

DataCollectionNodeModel(*[, type, queueID, ...])

DataCollectionParameters(*[, shape, ...])

EnergyScanNodeModel(*[, type, queueID, ...])

EnergyScanParameters(*[, shape, directory, ...])

GenericTaskNodeModel(*[, type, queueID, ...])

GenericTaskParameters(*[, shape, directory, ...])

Parameters of tasks defined by a queue entry DATA_MODEL, for instance the SSX collections.

QueueNodeModel(*[, type, queueID, checked, ...])

SampleNode(*[, type, queueID, checked, ...])

TaskDataPathModel(*[, shape, directory, ...])

TaskNodeModel(*[, type, queueID, checked, ...])

WorkflowNodeModel(*[, type, queueID, ...])

WorkflowParameters(*[, shape, directory, ...])

XRFNodeModel(*[, type, queueID, checked, ...])

XRFParameters(*[, shape, directory, ...])

class mxcubecore.queuelib.models.CharacterisationNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None, parameters: CharacterisationParameters)[source]

Bases: TaskNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.CharacterisationParameters(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '', first_image: int = 0, num_images: int = 0, osc_start: float = 0, osc_range: float = 0, osc_total_range: float = 0, offset: float = 0, kappa: float | None = 0, kappa_phi: float | None = 0, exp_time: float = 0, num_lines: int = 1, energy: float = 0, resolution: float = 0, detector_distance: float = 0, transmission: float = 100, shutterless: bool = True, take_snapshots: int = 0, detector_binning_mode: str | None = None, detector_roi_mode: int = 0, mesh_range: dict[str, float] = {}, num_triggers: int = 0, num_images_per_trigger: int = 0, cell_counting: str | None = None, mesh_center: str | None = None, cell_spacing: tuple[float, float] | None = None, sub_wedge_size: int = 10, disable_processing: bool = False, inverse_beam: bool = False, space_group: str = '', cellA: float = 0, cellB: float = 0, cellC: float = 0, cellAlpha: float = 0, cellBeta: float = 0, cellGamma: float = 0, helical: bool = False, mesh: bool = False, taskIndexList: list[int] | None = None, wedges: list[DataCollectionNodeModel] = [], swNumImages: int = 0, experiment_type: int | str = '', use_aimed_resolution: float = 0, use_aimed_multiplicity: float = 0, aimed_multiplicity: float = 0, aimed_i_sigma: float = 0, aimed_completness: float = 0, strategy_complexity: str = '', strategy_program: str = '', induce_burn: bool = False, use_permitted_rotation: bool = False, permitted_phi_start: float = 0, permitted_phi_end: float = 0, low_res_pass_strat: bool = False, max_crystal_vdim: float = 0, min_crystal_vdim: float = 0, max_crystal_vphi: float = 0, min_crystal_vphi: float = 0, use_min_dose: float = 0, use_min_time: float = 0, min_dose: float = 0, min_time: float = 0, account_rad_damage: bool = False, auto_res: bool = False, opt_sad: bool = False, sad_res: float = 0, determine_rad_params: bool = False, burn_osc_start: float = 0, burn_osc_interval: float = 0, rad_suscept: float = 0, beta: float = 0, gamma: float = 0)[source]

Bases: DataCollectionParameters

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.DataCollectionNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None, parameters: DataCollectionParameters)[source]

Bases: TaskNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.DataCollectionParameters(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '', first_image: int = 0, num_images: int = 0, osc_start: float = 0, osc_range: float = 0, osc_total_range: float = 0, offset: float = 0, kappa: float | None = 0, kappa_phi: float | None = 0, exp_time: float = 0, num_lines: int = 1, energy: float = 0, resolution: float = 0, detector_distance: float = 0, transmission: float = 100, shutterless: bool = True, take_snapshots: int = 0, detector_binning_mode: str | None = None, detector_roi_mode: int = 0, mesh_range: dict[str, float] = {}, num_triggers: int = 0, num_images_per_trigger: int = 0, cell_counting: str | None = None, mesh_center: str | None = None, cell_spacing: tuple[float, float] | None = None, sub_wedge_size: int = 10, disable_processing: bool = False, inverse_beam: bool = False, space_group: str = '', cellA: float = 0, cellB: float = 0, cellC: float = 0, cellAlpha: float = 0, cellBeta: float = 0, cellGamma: float = 0, helical: bool = False, mesh: bool = False, taskIndexList: list[int] | None = None, wedges: list[DataCollectionNodeModel] = [], swNumImages: int = 0)[source]

Bases: TaskDataPathModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.EnergyScanNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None, parameters: EnergyScanParameters)[source]

Bases: TaskNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.EnergyScanParameters(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '', element: str = '', edge: str = '')[source]

Bases: TaskDataPathModel

Parameters:
  • shape (str | int)

  • directory (str)

  • process_directory (str)

  • xds_dir (str)

  • base_prefix (str)

  • mad_prefix (str)

  • reference_image_prefix (str)

  • wedge_prefix (str)

  • run_number (int)

  • suffix (str)

  • precision (int)

  • start_num (int)

  • num_files (int)

  • compression (bool)

  • path (str)

  • prefix (str)

  • fileName (str | None)

  • fullPath (str | None)

  • subdir (str)

  • element (str)

  • edge (str)

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.GenericTaskNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None, parameters: GenericTaskParameters)[source]

Bases: TaskNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.GenericTaskParameters(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '', first_image: int = 0, num_images: int = 0, osc_start: float = 0, osc_range: float = 0, osc_total_range: float = 0, offset: float = 0, kappa: float | None = 0, kappa_phi: float | None = 0, exp_time: float = 0, num_lines: int = 1, energy: float = 0, resolution: float = 0, detector_distance: float = 0, transmission: float = 100, shutterless: bool = True, take_snapshots: int = 0, detector_binning_mode: str | None = None, detector_roi_mode: int = 0, mesh_range: dict[str, float] = {}, num_triggers: int = 0, num_images_per_trigger: int = 0, cell_counting: str | None = None, mesh_center: str | None = None, cell_spacing: tuple[float, float] | None = None, sub_wedge_size: int = 10, disable_processing: bool = False, inverse_beam: bool = False, space_group: str = '', cellA: float = 0, cellB: float = 0, cellC: float = 0, cellAlpha: float = 0, cellBeta: float = 0, cellGamma: float = 0, helical: bool = False, mesh: bool = False, taskIndexList: list[int] | None = None, wedges: list[DataCollectionNodeModel] = [], swNumImages: int = 0, **extra_data: Any)[source]

Bases: DataCollectionParameters

Parameters of tasks defined by a queue entry DATA_MODEL, for instance the SSX collections. The fields that are not defined here are kept, they are validated by the DATA_MODEL of the queue entry.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.QueueNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0)[source]

Bases: BaseModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.SampleNode(*, type: str = '', queueID: int = -1, checked: bool = False, state: int | None = None, sampleID: str, limsID: int | None = None, code: str | None = None, location: str, cell_no: int = 0, puck_no: int = 1, sampleName: str, proteinAcronym: str | None = '', defaultPrefix: str | None = '', defaultSubDir: str | None = '', tasks: list[DataCollectionNodeModel | CharacterisationNodeModel | XRFNodeModel | EnergyScanNodeModel | WorkflowNodeModel | GenericTaskNodeModel], crystalUUID: str | None = None, image_url: str = '', image_x: str | None = None, image_y: str | None = None, loadable: bool = True, puck_barcode: str | None = None, puck_type: str | None = None, sample_barcode: str = '', sc_state: str = '', containerCode: str | None = None, crystalSpaceGroup: str | None = None, cellA: float | None = None, cellB: float | None = None, cellC: float | None = None, cellAlpha: float | None = None, cellBeta: float | None = None, cellGamma: float | None = None)[source]

Bases: QueueNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.TaskDataPathModel(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '')[source]

Bases: BaseModel

Parameters:
  • shape (str | int)

  • directory (str)

  • process_directory (str)

  • xds_dir (str)

  • base_prefix (str)

  • mad_prefix (str)

  • reference_image_prefix (str)

  • wedge_prefix (str)

  • run_number (int)

  • suffix (str)

  • precision (int)

  • start_num (int)

  • num_files (int)

  • compression (bool)

  • path (str)

  • prefix (str)

  • fileName (str | None)

  • fullPath (str | None)

  • subdir (str)

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.TaskNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None)[source]

Bases: QueueNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.WorkflowNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None, parameters: WorkflowParameters)[source]

Bases: TaskNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.WorkflowParameters(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '', beam_size: str | None = None, cell_count: int | None = None, doc: str = '', label: str = '', name: str | None = None, numCols: int = 0, numRows: int = 0, requires: list[str] = [], type: str = '', wfname: str = '', wfpath: str = '')[source]

Bases: TaskDataPathModel

Parameters:
  • shape (str | int)

  • directory (str)

  • process_directory (str)

  • xds_dir (str)

  • base_prefix (str)

  • mad_prefix (str)

  • reference_image_prefix (str)

  • wedge_prefix (str)

  • run_number (int)

  • suffix (str)

  • precision (int)

  • start_num (int)

  • num_files (int)

  • compression (bool)

  • path (str)

  • prefix (str)

  • fileName (str | None)

  • fullPath (str | None)

  • subdir (str)

  • beam_size (str | None)

  • cell_count (int | None)

  • doc (str)

  • label (str)

  • name (str | None)

  • numCols (int)

  • numRows (int)

  • requires (list[str])

  • type (str)

  • wfname (str)

  • wfpath (str)

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.XRFNodeModel(*, type: str = '', queueID: int = -1, checked: bool = False, state: int = 0, label: str = '', sampleID: str, sampleQueueID: int | None = None, taskIndex: int | None = None, diffractionPlan: list[DataCollectionNodeModel] | None = None, diffractionPlanID: int | None = None, isDiffractionPlan: bool = False, name: str | None = None, parameters: XRFParameters)[source]

Bases: TaskNodeModel

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.queuelib.models.XRFParameters(*, shape: str | int = '', directory: str = '', process_directory: str = '', xds_dir: str = '', base_prefix: str = '', mad_prefix: str = '', reference_image_prefix: str = '', wedge_prefix: str = '', run_number: int = 0, suffix: str = '', precision: int = 0, start_num: int = 0, num_files: int = 0, compression: bool = False, path: str = '', prefix: str = '', fileName: str | None = '', fullPath: str | None = '', subdir: str = '', countTime: float = 0, exp_time: float = 0)[source]

Bases: TaskDataPathModel

Parameters:
  • shape (str | int)

  • directory (str)

  • process_directory (str)

  • xds_dir (str)

  • base_prefix (str)

  • mad_prefix (str)

  • reference_image_prefix (str)

  • wedge_prefix (str)

  • run_number (int)

  • suffix (str)

  • precision (int)

  • start_num (int)

  • num_files (int)

  • compression (bool)

  • path (str)

  • prefix (str)

  • fileName (str | None)

  • fullPath (str | None)

  • subdir (str)

  • countTime (float)

  • exp_time (float)

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

mxcubecore.queuelib.models.validate_model_tolerant(model_cls, data)[source]

Validate <data> against <model_cls>, tolerating unknown fields.

Unknown/extra fields (model_config extra=”forbid”) are logged as a warning and dropped rather than failing the request; any other validation error (missing or invalid field) is re-raised as-is.

mxcubecore.queuelib.models.validate_path(path: str) → str[source]

Validate a path without requiring it to exist.

Self-contained copy of mxcubeweb.core.models.generic.validate_path, kept in sync deliberately rather than imported, so this package has no dependency on mxcubeweb.

Parameters:

path (str)

Return type:

str