API: vaft.database

Generated from each module's __all__ by python -m vaft._api_catalog: 332 published objects in 34 modules. Signatures and summaries are read from the source; nothing here is written by hand. All API pages

vaft.database
exportfunction
export_summaryfunction
get_summary_presetfunction
loadfunction
openfunction
savefunction
summaryfunction
vaft.database.composition
composefunction
compose_stage_productsfunction
eddy_no_output_reasonfunction
EddyNoOutputErrorclass
impa_channelsfunction
StageCompositionErrorclass
vaft.database.corrective_lineage
CORRECTIVE_LINEAGEdata
DEFAULT_STAGESdata
scopedfunction
stage_scopefunction
UPSTREAMdata
vaft.database.digitizer_hdf5
container_pathfunction
DigitizerPackErrorclass
fsync_pathfunction
GZIP_LEVELdata
load_digitizer_hdf5function
pack_digitizer_csvfunction
PackResultclass
read_attributesfunction
rebuild_csv_bytesfunction
restore_csvfunction
SCHEMAdata
SCHEMA_VERSIONdata
SUFFIXdata
verify_containerfunction
vaft.database.filedb
ArtifactClassclass
audit_filedb_grammarfunction
audit_legacy_filedbfunction
EquilibriumFamilyclass
FileDBclass
FileDBConfigErrorclass
FileDBDomainclass
FileDBErrorclass
FileDBPathErrorclass
GPECCodeclass
GrammarRelocationclass
GrammarRelocationReportclass
LEGACY_DCON_PRODUCTdata
LEGACY_FAMILYdata
LEGACY_REFINEMENTdata
LegacyAuditEntryclass
LegacyAuditReportclass
LegacyCollisionclass
LegacyDuplicateclass
LegacyMissingProductclass
LegacyResolutionclass
OMASStageclass
Refinementclass
relocate_filedb_grammarfunction
StabilityProductclass
stage_lineagefunction
vaft.database.h5image
canonical_infofunction
derived_filenamefunction
H5IMAGE_CHUNK_BYTESdata
H5IMAGE_SCHEMA_VERSIONdata
H5ImageUnavailableErrorclass
is_derived_filenamefunction
materialize_imagefunction
publish_imagefunction
read_manifestfunction
vaft.database.hscfg
active_pathfunction
configured_keysfunction
default_pathfunction
HSCFG_KEYSdata
insecure_permissionsfunction
read_valuesfunction
render_updatefunction
SECRET_KEYSdata
update_hscfgfunction
validate_valuefunction
write_privatefunction
vaft.database.ids
loadfunction
savefunction
vaft.database.instrumentation
active_recorderfunction
IORecorderclass
record_iofunction
RUN_ID_HEADERdata
vaft.database.lazy_common
decode_hdf5_valuefunction
discover_hsds_idsfunction
normalize_idsfunction
vaft.database.lazy_imas
HSDSIMASHandleclass
LazyIMASClosedErrorclass
open_imasfunction
vaft.database.lazy_ods
HSDSODSclass
HSDSStoreclass
LazyODSClosedErrorclass
open_odsfunction
vaft.database.maintenance
audit_master_linkfunction
audit_master_linksfunction
ImpaResidueclass
ImpaStripErrorclass
ImpaStripWriteErrorclass
inspect_impa_residuefunction
MASTER_ABSENTdata
MASTER_COMPLETEdata
MASTER_LINKS_MISSINGdata
MASTER_MISSINGdata
MASTER_NAN_ONLY_UNLINKEDdata
MASTER_REPAIREDdata
MASTER_STUBS_UNLINKEDdata
MASTER_UNREADABLEdata
strip_impa_from_shotsfunction
strip_impa_from_sourcefunction
vaft.database.ods
exist_ts_filefunction
loadfunction Deprecated
load_odsfunction
MASTER_FILENAMEdata
save_odsfunction
upload_orderfunction
vaft.database.plotting
available_plotsfunction
composefunction
ddfunction
extractfunction
plot_diagnostics_time_interactivefunction
plot_equilibrium_interactivefunction
renderfunction
render_to_filefunction
stored_idsfunction
vaft.database.product_migration
audit_product_containersfunction
LEGACY_SUFFIXdata
migrate_product_containersfunction
MIGRATIONSdata
ProductMigrationclass
ProductMigrationErrorclass
ProductMigrationReportclass
PROJECTIONSdata
Recontainmentclass
sweep_superseded_productsfunction
vaft.database.production_qa
mhd_linear_run_coverage_modelfunction
raw_acquisition_qa_modelfunction
render_stage_plotsfunction
stage_plot_filenamesfunction
STAGE_VALIDATION_PLOTSdata
stagesfunction
validation_plotsfunction
ValidationPlotclass
vaft.database.provenance
ChainLinkclass
ChainReportclass
NOT_RECORDEDdata
verify_chainfunction
vaft.database.raw
compare_db_and_dumped_raw_signals_for_shotfunction
CONFIG_FILEdata
configurationfunction
date_from_shotfunction
dump_all_raw_signals_for_shotfunction
EXCLUDED_FIELD_CODESdata
FAST_DTdata
FAST_SPAN_Sdata
get_all_field_codes_for_shotfunction
init_poolfunction
KEY_FILEdata
last_shotfunction
list_shotsfunction
loadfunction
load_or_generate_keyfunction
load_rawfunction
MAX_RETRIESdata
MixedCadenceErrorclass
namefunction
plotfunction
POOL_SIZEdata
RawSignalUnavailableErrorclass
RawSourcedata
require_signalfunction
SecureConfigManagerclass
setup_raw_dbfunction
shots_from_datefunction
SLOW_DTdata
SLOW_DT_THRESHOLDdata
SLOW_SPAN_Sdata
sql_loading_availablefunction
SQL_TABLE_PATHdata
upgrade_archive_timebasefunction
V2_LAST_SHOTdata
vest_check_tablefunction
vest_connection_poolfunction
vest_datefunction
vest_loadfunction
vest_load_by_namefunction
vest_load_shot_waveform_2function
vest_load_shot_waveform_3function
vest_shotsfunction
vestdb_is_data_existfunction
waveform_generation_for_shotfunction
vaft.database.replication
is_reusablefunction
merge_remote_masterfunction
NOTHING_TO_REPLICATE_STATUSESdata
ProductNotEligibleErrorclass
read_recordfunction
REPLICABLE_STATUSESdata
replicate_stagefunction
REPLICATION_SCHEMA_VERSIONdata
ReplicationErrorclass
ReplicationRecordclass
RoundTripValidationErrorclass
StageNotReplicableErrorclass
write_recordfunction
vaft.database.retirement
copy_refinementfunction
delete_retired_sourcefunction
plan_retirementfunction
REFINEMENT_DESTINATIONdata
REFINEMENT_IDSdata
RetirementErrorclass
RetirementReportclass
RETIRING_SOURCEdata
ShotRetirementclass
STABILITY_IDSdata
vaft.database.sources
ATLAS_LINEAGE_FAMILIESdata
CATALOGdata
childrenfunction
DEFAULT_SOURCEdata
describefunction
EXTRA_SOURCES_VARIABLEdata
family_for_atlas_lineagefunction
FAMILY_LINEAGE_NAMESdata
FAMILY_SOURCESdata
HSDSSourceclass
HSDSSourceErrorclass
is_writablefunction
known_sourcesfunction
LEGACY_SOURCEdata
MissingSourceErrorclass
OccurrenceMigrationclass
parse_tglf_configurationfunction
ReadOnlySourceErrorclass
replicable_stagesfunction
replication_for_stagefunction
resolvefunction
source_for_stagefunction
STAGE_REPLICATIONdata
STAGE_SOURCEdata
StageReplicationclass
tglf_configurationfunction
tglf_configurationsfunction
TGLF_FIELD_MODELSdata
TGLF_SAT_RULESdata
TRANSITIONAL_UNTILdata
turbulent_transport_migrationfunction
turbulent_transport_occurrence_namefunction
turbulent_transport_sourcefunction
UnknownSourceErrorclass
vaft.database.staging
create_partial_masterfunction
external_h5_linksfunction
HSDSDomainCacheclass
merge_master_linksfunction
requested_ids_from_pathsfunction
stage_imas_shotfunction
vaft.database.transport
HSDSCommandErrorclass
HSDSCommandNotFoundErrorclass
HSDSTransportErrorclass
HSDSTransportVerificationErrorclass
run_hsgetfunction
run_hsloadfunction
verify_uploaded_imagefunction
vaft.database.utils
CP_REGISTRY_GROUPdata
CX_REGISTRY_GROUPdata
ensure_imas_hdf5_userblockfunction
exist_shotfunction
is_connectfunction
processed_registry_urifunction
read_legacy_processed_registryfunction
require_source_existsfunction
TS_REGISTRY_GROUPdata
vaft.database.worker.classify
Classificationclass
Classifierclass
DAQ_MISSINGdata
load_classifierfunction
RAW_INCOMPLETEdata
RAW_ONLYdata
RawFieldClassifierclass
ShotObservationclass
UNCLASSIFIEDdata
vaft.database.worker.config
CONFIG_ENVIRONMENT_VARIABLEdata
load_pipeline_configfunction
load_worker_configfunction
worker_config_from_mappingfunction
WorkerConfigclass
WorkerConfigErrorclass
vaft.database.worker.corrective
CONFIG_ENVIRONMENT_VARIABLEdata
corrective_config_from_mappingfunction
CorrectiveCycleReportclass
CorrectiveHarvesterclass
CorrectivePlanclass
CorrectiveRunnerclass
CorrectiveStateclass
CorrectiveWorkerclass
CorrectiveWorkerConfigclass
load_corrective_configfunction
load_corrective_pipeline_configfunction
read_corrective_statefunction
SHOT_STATESdata
ShotOutcomeclass
UploadScannerclass
UploadSignatureclass
vaft.database.worker.poll
MATCH_QUIET_SECONDSdata
require_sql_credentialsfunction
ShotSourceclass
SqlShotSourceclass
upload_finishedfunction
vaft.database.worker.runner
live_snakemake_infunction
RunPlanclass
RunResultclass
SnakemakeRunnerclass
vaft.database.worker.service
CycleReportclass
PipelineWorkerclass
vaft.database.worker.state
COMPLETEDdata
DETECTEDdata
EXCLUDEDdata
FAILEDdata
GAVE_UPdata
PARTIALdata
QUEUEDdata
read_worker_statefunction
RUNNINGdata
SHOT_STATESdata
WorkerStateclass
vaft.database.worker.status
load_pipeline_paths_modulefunction
MANIFESTdata
MISSINGdata
OK_STATUSESdata
PipelineHarvesterclass
REPLICATIONdata
ShotOutcomeclass
StageStatusclass
StageTargetclass

vaft.database

Database access and storage infrastructure.

export

function source
export(shot, source=None, *, backend, output=None, overwrite=False, occurrence=0, cache='auto', transport='auto')

Export one shot from an HSDS source as portable local files.

export_summary

function source
export_summary(df, path, *, mode='replace', key_columns=None, replace_groups=None)

Serialize or upsert an already-generated summary DataFrame.

get_summary_preset

function source
get_summary_preset(name)

Return the SummaryPreset describing one canonical summary sheet.

load

function source
load(shot: int | list[int], source: str | None = None, *, directory: str | None = None, representation: Literal['omas', 'imas'] = 'omas', paths: str | list[str] | None = None, occurrence: int | Mapping[str, int] | None = None, imas_version: str | None = None, cache: str = 'auto', transport: Literal['auto', 'canonical', 'h5image'] = 'auto')

Materialize an OMAS ODS or native IMAS IDS from remote HSDS storage.

open

function source
open(shot: int, *, source: str | None = None, directory: str | None = None, representation: Literal['omas', 'imas'] = 'omas', paths: str | list[str] | None = None, occurrence: int | Mapping[str, int] | None = None, imas_version: str | None = None)

Open a read-only lazy OMAS ODS or native IMAS IDS adapter over HSDS.

save

function source
save(data, shot: int, *, source: str | None = None, target: str | None = None, directory: str | None = None, representation: Literal['omas', 'imas'] | None = None, occurrence: int | Mapping[str, int] | None = None, imas_version: str | None = None, derived_cache: Literal['auto', 'none', 'imas-images', 'omas', 'both'] = 'auto', finalize_master: Callable[[Path], None] | None = None)

Write an OMAS ODS or native IDS to remote HSDS storage.

summary

function source
summary(shot_range=None, *, preset='equilibrium_global', source=None, directory=None)

Return a canonical preset summary for a range or all available shots.

vaft.database.composition

Explicit composition of one shot across named HSDS sources (issue #305).

compose

function source
compose(shot: int, sources: Sequence[str] = ('main', 'impa'), *, paths: Iterable[str] | None = None, occurrence: int | None = None) -> tuple[Any, dict[str, Any]]

Load shot from several sources and append the optional channels.

Also exported as vaft.database.compose.

compose_stage_products

function source
compose_stage_products(*, diagnostics: str | Path, eddy: str | Path, eddy_manifest: str | Path | None = None, strict: bool = True) -> tuple[Any, dict[str, Any]]

Union a diagnostics product with the eddy product computed from it.

eddy_no_output_reason

function source
eddy_no_output_reason(eddy_manifest: str | Path | None) -> str | None

The recorded reason when eddy_manifest says no_output, else None.

EddyNoOutputError

class source
EddyNoOutputError(path: Path, reason: str) -> None

The eddy stage finished no_output: there are no passive currents to compose.

impa_channels

function source
impa_channels(ods: Any, node: str) -> list[int]

Return the indices of node holding IMPA channels, by identifier.

StageCompositionError

class source

Two stage products that cannot be composed into one shot.

vaft.database.corrective_lineage

The stages of pipeline 2 and what each needs first (issue #1842).

CORRECTIVE_LINEAGE

data
CORRECTIVE_LINEAGE = ('thomson', 'ces', 'core_profiles', 'composition', 'ti_inferred', 'resistive_zeff', 'electron_efit', 'kinetic_efit')

DEFAULT_STAGES

data
DEFAULT_STAGES = ('thomson', 'ces', 'core_profiles', 'composition', 'electron_efit', 'kinetic_efit')

scoped

function source
scoped(scope: frozenset[str] | None) -> tuple[str, ...]

The lineage’s stages inside scope, in lineage order (all of them for None).

stage_scope

function source
stage_scope(value: Iterable[str] | str | None) -> frozenset[str] | None

The stages a run builds and judges, from the configuration’s stages key.

UPSTREAM

data
UPSTREAM = <builtins.dict>

vaft.database.digitizer_hdf5

Lossless HDF5 container for VEST soft X-ray digitizer records.

container_path

function source
container_path(csv_path: str | Path) -> Path

Where the container for digitizer_{daq}_{shot}.csv lives.

DigitizerPackError

class source

A CSV could not be packed without loss; the CSV was left untouched.

fsync_path

function source
fsync_path(path: str | Path) -> None

Force a file (or directory) to stable storage before anything depends on it.

GZIP_LEVEL

data
GZIP_LEVEL = 4

load_digitizer_hdf5

function source
load_digitizer_hdf5(path: str | Path, *, nrows: int | None = None) -> np.ndarray

Return the (channels, samples) array a container holds.

pack_digitizer_csv

function source
pack_digitizer_csv(csv_path: str | Path, target: str | Path | None = None, *, shot: int | None = None, daq_label: str | None = None, overwrite: bool = False) -> PackResult

Write the lossless container for one digitizer CSV and verify it.

PackResult

class source
PackResult(source: Path, target: Path, shape: tuple[int, int], source_size: int, target_size: int, source_sha256: str) -> None
6 fields · 1 members
  • source: Path
  • target: Path
  • shape: tuple[int, int]
  • source_size: int
  • target_size: int
  • source_sha256: str
  • ratio property source

read_attributes

function source
read_attributes(path: str | Path) -> dict[str, Any]

rebuild_csv_bytes

function source
rebuild_csv_bytes(data: np.ndarray, line_terminator: str = '\r\n') -> bytes

Regenerate the CSV text sample_v3.py wrote for data.

restore_csv

function source
restore_csv(path: str | Path, target: str | Path | None = None) -> Path

Write the original CSV back out of a verified container.

SCHEMA

data
SCHEMA = 'vaft.soft_x_rays.digitizer'

SCHEMA_VERSION

data
SCHEMA_VERSION = 1

SUFFIX

data
SUFFIX = '.h5'

verify_container

function source
verify_container(path: str | Path, *, expected_sha256: str | None = None) -> str

Regenerate the source CSV from a container and check its sha256.

vaft.database.filedb

Canonical FileDB paths and read-only legacy-layout auditing APIs.

ArtifactClass

class source
7 fields
  • INPUT: 'input'
  • OUTPUT: 'output'
  • LOG: 'log'
  • PLOT: 'plot'
  • CONFIG: 'config'
  • WORK: 'work'
  • METADATA: 'metadata'

audit_filedb_grammar

function source
audit_filedb_grammar(root: str | os.PathLike[str]) -> GrammarRelocationReport

Plan a canonical root’s move onto the lineage-bearing grammar, changing nothing.

audit_legacy_filedb

function source
audit_legacy_filedb(legacy_root: str | os.PathLike[str], *, target_root: str | os.PathLike[str] | None = None, expected_products: Mapping[str, str] | None = None) -> LegacyAuditReport

Inventory and propose mappings without modifying either FileDB root.

EquilibriumFamily

class source

The reconstruction lineage an equilibrium came from.

3 fields
  • MAGNETIC: 'magnetic'
  • ELECTRON: 'electron'
  • KINETIC: 'kinetic'

FileDB

class source
FileDB(root: str | os.PathLike[str]) -> None

Resolve canonical OMAS-first FileDB paths without filesystem writes.

13 members
  • from_config classmethod — Resolve root precedence: explicit config, canonical environment. source
  • resolve method — Return a path from the canonical grammar without creating it. source
  • raw method — Return the flat per-shot raw archive directory. source
  • legacy method — Return legacy/{diagnostic}/{shot}[/{artifact}]. source
  • omas method source
  • efit method source
  • chease method source
  • gpec method — One stability cell: (family, refinement, product, shot, n_tor). source
  • omas_product method — Return the finalized ODS file one OMAS stage writes. source
  • omas_manifest method — Return the stage manifest recording how the product was produced. source
  • omas_replication_record method — Return the record of whether this product reached a remote backend. source
  • pipeline method — Return a canonical, batch-scoped pipeline product directory. source
  • resolve_legacy_readonly method — Resolve the former {shot}/{area} hierarchy without writes. source

FileDBConfigError

class source

Raised when the FileDB storage root cannot be configured.

FileDBDomain

class source
7 fields
  • RAW: 'raw'
  • LEGACY: 'legacy'
  • OMAS: 'omas'
  • EFIT: 'efit'
  • CHEASE: 'chease'
  • GPEC: 'gpec'
  • PIPELINE: 'pipeline'

FileDBError

class source

Base error for invalid FileDB configuration or path requests.

FileDBPathError

class source

Raised when a path request is outside the canonical grammar.

GPECCode

class source

Legacy stability code names.

4 fields
  • DCON: 'dcon'
  • RDCON: 'rdcon'
  • STRIDE: 'stride'
  • IDEAL_GPEC: 'ideal-gpec'

GrammarRelocation

class source
GrammarRelocation(source: str, target: str, rule: str) -> None

One subtree that moves, and the rule that says where.

3 fields
  • source: str
  • target: str
  • rule: str

GrammarRelocationReport

class source
GrammarRelocationReport(root: str, applied: bool, relocations: tuple[GrammarRelocation, ...], already_canonical: tuple[str, ...], collisions: tuple[str, ...], unrecognized: tuple[str, ...], unattributable: tuple[str, ...] = ()) -> None

What a canonical root needs before it resolves under the new grammar.

7 fields · 2 members
  • root: str
  • applied: bool
  • relocations: tuple[GrammarRelocation, ...]
  • already_canonical: tuple[str, ...]
  • collisions: tuple[str, ...]
  • unrecognized: tuple[str, ...]
  • unattributable: tuple[str, ...]
  • safe_to_apply property — Whether applying this plan would move every subtree it found. source
  • to_dict method source

LEGACY_DCON_PRODUCT

data
LEGACY_DCON_PRODUCT = 'dcon'

LEGACY_FAMILY

data
LEGACY_FAMILY = 'magnetic'

LEGACY_REFINEMENT

data
LEGACY_REFINEMENT = 'chease'

LegacyAuditEntry

class source
LegacyAuditEntry(source: str, proposed_target: str | None, status: str, reason: str | None = None, size: int | None = None, sha256: str | None = None) -> None
6 fields
  • source: str
  • proposed_target: str | None
  • status: str
  • reason: str | None
  • size: int | None
  • sha256: str | None

LegacyAuditReport

class source
LegacyAuditReport(legacy_root: str, target_root: str, entries: tuple[LegacyAuditEntry, ...], collisions: tuple[LegacyCollision, ...], duplicates: tuple[LegacyDuplicate, ...], symlinks: tuple[str, ...], missing_products: tuple[LegacyMissingProduct, ...]) -> None
7 fields · 2 members
  • legacy_root: str
  • target_root: str
  • entries: tuple[LegacyAuditEntry, ...]
  • collisions: tuple[LegacyCollision, ...]
  • duplicates: tuple[LegacyDuplicate, ...]
  • symlinks: tuple[str, ...]
  • missing_products: tuple[LegacyMissingProduct, ...]
  • unmapped property source
  • to_dict method source

LegacyCollision

class source
LegacyCollision(proposed_target: str, sources: tuple[str, ...], existing_target: bool = False, existing_target_kind: str | None = None) -> None
4 fields
  • proposed_target: str
  • sources: tuple[str, ...]
  • existing_target: bool
  • existing_target_kind: str | None

LegacyDuplicate

class source
LegacyDuplicate(sha256: str, size: int, sources: tuple[str, ...]) -> None
3 fields
  • sha256: str
  • size: int
  • sources: tuple[str, ...]

LegacyMissingProduct

class source
LegacyMissingProduct(shot: int, product: str, expected_source: str) -> None
3 fields
  • shot: int
  • product: str
  • expected_source: str

LegacyResolution

class source
LegacyResolution(path: Path, exists: bool, read_only: bool = True, layout: str = 'legacy-shot-first') -> None

An explicitly read-only path into the former shot-first layout.

4 fields
  • path: Path
  • exists: bool
  • read_only: bool
  • layout: str

OMASStage

class source
22 fields
  • STATIC: 'static'
  • DIAGNOSTICS: 'diagnostics'
  • IMPA: 'impa'
  • THOMSON: 'thomson'
  • CES: 'ces'
  • EDDY: 'eddy'
  • EFIT: 'efit'
  • CORE_PROFILES: 'core_profiles'
  • COMPOSITION: 'composition'
  • TI_INFERRED: 'ti_inferred'
  • RESISTIVE_ZEFF: 'resistive_zeff'
  • ELECTRON_EFIT: 'electron_efit'
  • KINETIC_EFIT: 'kinetic_efit'
  • CHEASE: 'chease'
  • MHD_LINEAR: 'mhd_linear'
  • GPEC_IDEAL: 'gpec_ideal'
  • NEOCLASSICAL: 'neoclassical'
  • TURBULENT_TRANSPORT: 'turbulent_transport'
  • SOFT_X_RAYS: 'soft_x_rays'
  • CAMERA_VISIBLE: 'camera_visible'
  • CAMERA_VISIBLE_FLUCTUATION: 'camera_visible_fluctuation'
  • SHOTLOG: 'shotlog'

Refinement

class source

The equilibrium actually handed to the stability solver.

2 fields
  • CHEASE: 'chease'
  • NONE: 'none'

relocate_filedb_grammar

function source
relocate_filedb_grammar(root: str | os.PathLike[str], *, apply: bool = False) -> GrammarRelocationReport

Move a canonical root onto the lineage-bearing grammar.

StabilityProduct

class source

One stability calculation.

6 fields
  • DCON_PEELING: 'dcon-peeling'
  • DCON_KINK: 'dcon-kink'
  • RDCON: 'rdcon'
  • STRIDE: 'stride'
  • IDEAL_GPEC: 'ideal-gpec'
  • DCON_LEGACY: 'dcon'

stage_lineage

function source
stage_lineage(stage: str, *, family: str, refinement: str | None = None, product: str | None = None) -> dict[str, str]

The lineage arguments an OMAS stage’s path takes, and only those.

vaft.database.h5image

Byte-exact derived HDF5 images for eager HSDS materialization.

canonical_info

function source
canonical_info(directory: str, shot: int, filename: str) -> dict[str, str | None]

derived_filename

function source
derived_filename(filename: str) -> str

H5IMAGE_CHUNK_BYTES

data
H5IMAGE_CHUNK_BYTES = 4194304

H5IMAGE_SCHEMA_VERSION

data
H5IMAGE_SCHEMA_VERSION = 1

H5ImageUnavailableError

class source

A requested derived HDF5 image is missing, stale, or corrupt.

is_derived_filename

function source
is_derived_filename(filename: str) -> bool

materialize_image

function source
materialize_image(directory: str, shot: int, filename: str, target: Path, *, source_info: dict[str, str | None]) -> dict[str, Any]

Restore and validate one derived image into an ordinary HDF5 file.

publish_image

function source
publish_image(local_path: Path, directory: str, shot: int, *, imas_version: str | None, source_info: dict[str, str | None] | None = None) -> dict[str, Any]

Publish one local canonical HDF5 file as a compressed opaque image.

read_manifest

function source
read_manifest(domain) -> dict[str, Any] | None

vaft.database.hscfg

Read and write the h5pyd credential file (.hscfg) without exposing secrets.

active_path

function source
active_path(cwd: Path | None = None) -> Path

The file h5pyd will actually read: ./.hscfg shadows ~/.hscfg.

configured_keys

function source
configured_keys(path: Path) -> tuple[str, ...]

Names of the h5pyd keys path sets to a non-empty value. Never values.

default_path

function source
default_path() -> Path

~/.hscfg, the file vaft hsds configure writes unless told otherwise.

HSCFG_KEYS

data
HSCFG_KEYS = ('hs_endpoint', 'hs_username', 'hs_password', 'hs_api_key')

insecure_permissions

function source
insecure_permissions(path: Path) -> bool

Whether path is group- or world-accessible. Always False on Windows.

read_values

function source
read_values(path: Path) -> dict[str, str]

Every key = value pair in path; the last occurrence wins, as in h5pyd.

render_update

function source
render_update(original: str, updates: Mapping[str, str]) -> str

original with each key in updates set, everything else untouched.

SECRET_KEYS

data
SECRET_KEYS = frozenset({'hs_api_key', 'hs_password'})

update_hscfg

function source
update_hscfg(path: Path, updates: Mapping[str, str]) -> None

Set updates in the .hscfg at path, creating it 0600 if needed.

validate_value

function source
validate_value(key: str, value: str) -> None

Refuse a value h5pyd would read back differently from what was typed.

write_private

function source
write_private(path: Path, text: str) -> None

Atomically replace path with text, readable by the owner only.

vaft.database.ids

IMAS HDF5 (ids image) HSDS interface module.

load

function source
load(shot: int, ids_name: Union[str, list[str]], source: Optional[str] = None, occurrence: int | dict[str, int] = 0, dd_version: Optional[str] = None, local_dir: Optional[str] = None, cache: str | Path = 'auto', transport: Literal['auto', 'canonical', 'h5image'] = 'auto', *, directory: Optional[str] = None) -> Union[object, dict[str, object]]

Load IDS object(s) from HSDS as native IMAS objects.

save

function source
save(ids: imas.ids_toplevel.IDSToplevel, shot: int, source: Optional[str] = None, dd_version: Optional[str] = None, *, directory: Optional[str] = None, derived_cache: Literal['auto', 'none', 'imas-images', 'omas', 'both'] = 'auto') -> Optional[str]

Save one native IMAS IDS to a remote HSDS namespace.

vaft.database.instrumentation

Opt-in I/O instrumentation for HSDS access (#1869).

active_recorder

function source
active_recorder() -> IORecorder | None

The innermost recorder, or None when nothing is recording.

IORecorder

class source
IORecorder(run_id: str, requests: list[dict[str, Any]] = <factory>, subprocesses: list[dict[str, Any]] = <factory>, started_wall: float = <factory>, ended_wall: float | None = None) -> None

The requests and subprocess transfers seen while it was active.

5 fields · 1 members
  • run_id: str
  • requests: list[dict[str, Any]]
  • subprocesses: list[dict[str, Any]]
  • started_wall: float
  • ended_wall: float | None
  • summary method — Counts, observed bytes and header-latency percentiles; None where nothing was measured. source

record_io

function source
record_io(run_id: str | None = None) -> Iterator[IORecorder]

Record HSDS I/O inside the block; patches requests.Session.send only while active.

RUN_ID_HEADER

data
RUN_ID_HEADER = 'X-VAFT-Run-ID'

vaft.database.lazy_common

Shared helpers for direct-HSDS lazy OMAS and IMAS adapters.

decode_hdf5_value

function source
decode_hdf5_value(value: Any) -> Any

Restore conventional Python/NumPy values from IMAS HDF5 storage.

discover_hsds_ids

function source
discover_hsds_ids(h5pyd_module: Any, directory: str, shot: int) -> tuple[str, ...]

List canonical IDS image domains for a shot.

normalize_ids

function source
normalize_ids(ids: str | Iterable[str] | None) -> tuple[str, ...] | None

Normalize an optional IDS restriction while preserving input order.

vaft.database.lazy_imas

Direct-HSDS, read-only lazy native IMAS IDS access.

HSDSIMASHandle

class source
HSDSIMASHandle(shot: int, source: str | None = None, *, directory: str | None = None, ids: str | Iterable[str] | None = None, imas_version: str, h5pyd_module: Any = None) -> None

Read-only context manager returning native lazy IDSToplevel objects.

5 members
  • ids property source
  • metrics property source
  • open method source
  • get method — Return a native, read-only, lazy IDSToplevel for an IDS. source
  • close method source

LazyIMASClosedError

class source

Raised when an uncached native IDS leaf is read after close().

open_imas

function source
open_imas(shot: int, source: str | None = None, *, directory: str | None = None, ids: str | Iterable[str] | None = None, imas_version: str) -> HSDSIMASHandle

vaft.database.lazy_ods

Lazy, selection-based OMAS access to IMAS HDF5 domains in HSDS.

HSDSODS

class source
HSDSODS(*, store: HSDSStore | None = None, dynamic: HSDSStore | None = None, imas_version: str | None = None, consistency_check: bool = True, **kwargs: Any) -> None

An omas.ODS whose missing leaves are fetched from HSDS.

3 members
  • keys method source
  • prefetch method — Bulk-read everything under location; see HSDSStore.prefetch. source
  • close method source

HSDSStore

class source
HSDSStore(shot: int, source: str | None = None, *, directory: str | None = None, ids: str | Iterable[str] | None = None, h5pyd_module: Any = None) -> None

OMAS dynamic backend for occurrence-zero IMAS HDF5 HSDS domains.

6 members
  • opened_ids property — IDS domains currently opened by this store (primarily diagnostic). source
  • metrics property — Snapshot lightweight client-side lazy-read instrumentation. source
  • open method source
  • close method source
  • prefetch method — Read every dataset under location in one request each, and serve it from memory. source
  • keys method source

LazyODSClosedError

class source

Raised when an uncached leaf is requested after closing a lazy ODS.

open_ods

function source
open_ods(shot: int, source: str | None = None, *, directory: str | None = None, ids: str | list[str] | None = None, imas_version: str | None = None, consistency_check: bool = True) -> HSDSODS

Open an occurrence-zero ODS that fetches only requested HSDS leaves.

vaft.database.maintenance

One-off repairs to already-published HSDS shots (issue #305).

audit_master_link

function source
audit_master_link(shot: int, *, source: str | None = None, repair: bool = False) -> dict[str, Any]

Does the shot’s master.h5 link every IDS file stored beside it (#913)?

audit_master_links

function source
audit_master_links(shots: Iterable[int], *, source: str | None = None, repair: bool = False) -> list[dict[str, Any]]

Run audit_master_link over many shots.

ImpaResidue

class source

What one published shot still carries, and whether it can be removed.

2 members

ImpaStripError

class source

Raised when a published shot cannot be stripped safely.

ImpaStripWriteError

class source

Raised when the rewrite failed after it had started touching the source.

inspect_impa_residue

function source
inspect_impa_residue(ods: Any) -> ImpaResidue

Report the IMPA channels in ods and whether they form a tail block.

MASTER_ABSENT

data
MASTER_ABSENT = 'absent'

MASTER_COMPLETE

data
MASTER_COMPLETE = 'complete'

MASTER_LINKS_MISSING

data
MASTER_LINKS_MISSING = 'links_missing'

MASTER_MISSING

data
MASTER_MISSING = 'no_master'

MASTER_NAN_ONLY_UNLINKED

data
MASTER_NAN_ONLY_UNLINKED = 'nan_only_unlinked'

MASTER_REPAIRED

data
MASTER_REPAIRED = 'repaired'

MASTER_STUBS_UNLINKED

data
MASTER_STUBS_UNLINKED = 'stubs_unlinked'

MASTER_UNREADABLE

data
MASTER_UNREADABLE = 'unreadable'

strip_impa_from_shots

function source
strip_impa_from_shots(shots: Iterable[int], *, source: str | None = None, apply: bool = False) -> list[dict[str, Any]]

Run strip_impa_from_source over many shots, recording refusals.

strip_impa_from_source

function source
strip_impa_from_source(shot: int, *, source: str | None = None, apply: bool = False) -> dict[str, Any]

Remove IMPA channels from one published shot’s baseline magnetics.

vaft.database.ods

OMAS ODS access backed by IMAS HDF5 images stored in HSDS.

exist_ts_file

functionDeprecated usage source
exist_ts_file(*args, **kwargs)

Return processed Thomson-scattering shots through the current helper.

load

functionDeprecatedDeprecated usage source
load(shot, source: Optional[str] = None, **kwargs)

Deprecated compatibility alias for load_ods.

Deprecated: Deprecated compatibility alias for ``load_ods``.

load_ods

function source
load_ods(shot: Union[int, list[int]], source: Optional[str] = None, *, directory: Optional[str] = None, occurrence: Optional[dict] = None, paths: Optional[list] = None, time: Optional[float] = None, imas_version: Optional[str] = None, skip_uncertainties: bool = False, consistency_check: bool = True, verbose: bool = False, path: Optional[Union[str, Path]] = None, local_dir: Optional[Union[str, Path]] = None, cache: Literal['auto', 'off'] | str | Path = 'auto', transport: Literal['auto', 'canonical', 'h5image'] = 'auto') -> Union[omas.ODS, list[omas.ODS]]

Load ODS data by reading IMAS images from {source}/{shot} and converting via OMAS.

MASTER_FILENAME

data
MASTER_FILENAME = 'master.h5'

save_ods

function source
save_ods(ods: omas.ODS, shot: int, filename: Optional[str] = None, env: str = 'server', *, source: Optional[str] = None, directory: Optional[str] = None, path: Optional[Union[str, Path]] = None, occurrence: Optional[dict] = None, user: Optional[str] = None, machine: Optional[str] = None, run: Optional[int] = None, imas_version: Optional[str] = None, verbose: bool = True, derived_cache: Literal['auto', 'none', 'imas-images', 'omas', 'both'] = 'auto', finalize_master: Optional[Callable[[Path], None]] = None) -> Optional[str]

Save ODS data by converting it to IMAS HDF5 images.

upload_order

function source
upload_order(filenames: Iterable[str]) -> list[str]

Order a shot’s files so the master is uploaded last.

vaft.database.plotting

Plot adapters for database shots: plot_<canonical-stem>(shot, source=...).

available_plots

function source
available_plots(shot: Any = None, source: str | None = None, *, query: str | None = None, detail: bool = False, available_only: bool | None = None, **filters: Any)

What can be plotted from a database shot, without downloading it.

compose

function source
compose(composition: Any, shot: Any, source: str | None = None, *, occurrence: Any = None, backend: str | None = None, show: bool = False, label: Any = 'shot', **presentation: Any) -> Any

Draw a vaft.plot.FigureComposition for database shots (issue #1467).

dd

function source
dd(name: str) -> tuple

The Data Dictionary paths plot name reads; nothing is opened.

extract

function source
extract(name: str, shot: Any, source: str | None = None, *, lazy: bool = True, occurrence: Any = None, label: Any = 'shot', **options: Any) -> Any

Open what plot name needs of shot and return its view model, undrawn.

plot_diagnostics_time_interactive

function source
plot_diagnostics_time_interactive(shot: Any, source: str | None = None, *, occurrence: Any = None, **options: Any) -> Any

The diagnostics overview with live controls, from the database (issue #482).

plot_equilibrium_interactive

function source
plot_equilibrium_interactive(shot: Any, source: str | None = None, *, occurrence: Any = None, **options: Any) -> Any

Explore one shot’s equilibrium slices, from the database.

render

function source
render(name: str, shot: Any, source: str | None = None, *, lazy: bool = True, occurrence: Any = None, ax: Any = None, show: bool = False, label: Any = 'shot', **options: Any) -> tuple[Any, Any]

Open what plot name needs of shot in source and render it.

render_to_file

function source
render_to_file(name: str, shot: Any, path: Any, source: str | None = None, *, lazy: bool = True, occurrence: Any = None, label: Any = 'shot', **options: Any) -> Any

Render plot name for shot and write it to path; returns path.

stored_ids

function source
stored_ids(shot: Any, source: str | None = None) -> tuple[str, ...]

The IDS shot stores in source, listed without reading any data.

vaft.database.product_migration

Move the OMAS stage products already on disk onto their declared shape (#813).

audit_product_containers

function source
audit_product_containers(root: str | Path, *, stages: Sequence[str] | None = None, verify_shape: bool = False) -> ProductMigrationReport

Classify every stage product under root. Reads only; writes nothing.

LEGACY_SUFFIX

data
LEGACY_SUFFIX = '.json'

migrate_product_containers

function source
migrate_product_containers(root: str | Path, *, stages: Sequence[str] | None = None, apply: bool = False) -> ProductMigrationReport

Bring every stage product under root onto its declared shape.

MIGRATIONS

data
MIGRATIONS = <builtins.tuple>

ProductMigration

class source
ProductMigration(stage: str, directory: str, source: str, target: str, verify: str) -> None

One product’s move, as the plan describes it.

5 fields
  • stage: str
  • directory: str
  • source: str
  • target: str
  • verify: str

ProductMigrationError

class source

A migration that refuses to run rather than guess.

ProductMigrationReport

class source
ProductMigrationReport(root: str, applied: bool, pending: tuple[ProductMigration, ...] = (), migrated: tuple[str, ...] = (), settled: tuple[str, ...] = (), conflicting: tuple[str, ...] = (), orphan_temporaries: tuple[str, ...] = (), unrecognized: tuple[str, ...] = (), deletion_blocked: tuple[str, ...] = (), failures: tuple[str, ...] = (), manifest_repairs: tuple[ProductMigration, ...] = ()) -> None

What a canonical root needs before its products match their declarations.

11 fields · 2 members
  • root: str
  • applied: bool
  • pending: tuple[ProductMigration, ...]
  • migrated: tuple[str, ...]
  • settled: tuple[str, ...]
  • conflicting: tuple[str, ...]
  • orphan_temporaries: tuple[str, ...]
  • unrecognized: tuple[str, ...]
  • deletion_blocked: tuple[str, ...]
  • failures: tuple[str, ...]
  • manifest_repairs: tuple[ProductMigration, ...]
  • safe_to_apply property — Whether every product found can be moved without a judgement call. source
  • to_dict method source

PROJECTIONS

data
PROJECTIONS = <builtins.dict>

Recontainment

class source
Recontainment(stage: str, from_suffix: str, to_suffix: str, keep_ids: tuple[str, ...] | None) -> None

One stage’s move from what is on disk to what it now declares.

4 fields · 1 members
  • stage: str
  • from_suffix: str
  • to_suffix: str
  • keep_ids: tuple[str, ...] | None
  • verify property source

sweep_superseded_products

function source
sweep_superseded_products(report: ProductMigrationReport, *, apply: bool = False) -> dict[str, Any]

Delete the originals the migration superseded. Irreversible.

vaft.database.production_qa

Post-generation validation plots for the FileDB pipeline (issue #139).

mhd_linear_run_coverage_model

function source
mhd_linear_run_coverage_model(manifest: Mapping[str, Any])

Build the DCON/RDCON/STRIDE run-coverage view model (issue #173 phase 1).

Also exported as vaft.validation.mhd_linear_run_coverage_model (deprecated).

raw_acquisition_qa_model

function source
raw_acquisition_qa_model(payload: Mapping[str, Any], *, required_fields: Sequence[int] = (), shot: int | None = None, max_signal_panels: int = 4)

Build the compact raw-acquisition QA view model for one shot.

Also exported as vaft.validation.raw_acquisition_qa_model (deprecated).

render_stage_plots

function source
render_stage_plots(stage: str, source: Any, output_dir: str | os.PathLike[str], **context: Any) -> dict[str, Any]

Render and persist stage’s validation plots into output_dir.

Also exported as vaft.validation.render_stage_plots (deprecated).

stage_plot_filenames

function source
stage_plot_filenames(stage: str, *, required_only: bool = False) -> tuple[str, ...]

File names stage writes into its plot/ directory.

Also exported as vaft.validation.stage_plot_filenames (deprecated).

STAGE_VALIDATION_PLOTS

data
STAGE_VALIDATION_PLOTS = <builtins.dict>

stages

function source
stages() -> tuple[str, ...]

Every stage with a declared validation-plot set, sorted.

Also exported as vaft.validation.stages (deprecated).

validation_plots

function source
validation_plots(stage: str) -> tuple[ValidationPlot, ...]

The declared plots for stage.

Also exported as vaft.validation.validation_plots (deprecated).

ValidationPlot

class source
ValidationPlot(plot: str, filename: str = '', required: bool = True, kind: str = 'ods', options: Mapping[str, Any] = <factory>) -> None

One figure a stage owes after its data product is generated.

Also exported as vaft.validation.ValidationPlot (deprecated).

5 fields
  • plot: str
  • filename: str
  • required: bool
  • kind: str
  • options: Mapping[str, Any]

vaft.database.provenance

Checking that a stability product descends from the equilibrium it claims.

ChainLink

class source
ChainLink(stage: str, upstream_stage: str, consumed_sha256: str, produced_by_upstream_sha256: str, status: str, detail: str = '') -> None

One consumed-produced pair, and whether the two agree.

6 fields · 1 members
  • stage: str
  • upstream_stage: str
  • consumed_sha256: str
  • produced_by_upstream_sha256: str
  • status: str
  • detail: str
  • verified property source

ChainReport

class source
ChainReport(shot: int | None, links: tuple[ChainLink, ...]) -> None

Whether a product’s recorded ancestry holds together.

2 fields · 4 members
  • shot: int | None
  • links: tuple[ChainLink, ...]
  • verified property — True only when every link was checked and agreed. source
  • broken property — Links whose two digests disagree – a product from another run. source
  • unrecorded property source
  • to_dict method source

NOT_RECORDED

data
NOT_RECORDED = ''

verify_chain

function source
verify_chain(*, chease_manifest: dict[str, Any], stability_input_sha256: str, efit_gfile_sha256: str | None = None, shot: int | None = None) -> ChainReport

Check a stability product’s recorded ancestry against its upstreams.

vaft.database.raw

MySQL-based VEST Database Access and Plotting

compare_db_and_dumped_raw_signals_for_shot

function source
compare_db_and_dumped_raw_signals_for_shot(shot: int, output_path: str = None, max_retries: int = 3, daq_type: int = 0, slow_dt_threshold: float = 5e-06) -> bool

Compare and plot original signals from database with signals loaded from JSON file

CONFIG_FILE

data
CONFIG_FILE = '/home/runner/.vest/database_raw_info.yaml'

configuration

function source
configuration() -> Tuple[str, str, str, str]

Load database configuration.

date_from_shot

function source
date_from_shot(shot: int) -> tuple

Returns (date_str, datetime_obj) for the given shot number from the shot table.

dump_all_raw_signals_for_shot

function source
dump_all_raw_signals_for_shot(shot: int, output_path: str = None, max_retries: int = 3, daq_type: int = 0, slow_dt_threshold: float = 5e-06, plot_opt: bool = False, sample_opt: bool | RawSource = False, fields: Optional[List[int]] = None) -> bool

Store shot data as JSON GZIP file (.json.gz) with the following steps: 1. Retrieve list of field codes 2. Load (time, data1D) using load_raw 3. Classify as fast/slow based on sampling interval (time[1]-time[0]) 4. Create shot_data = { “shot”: shot, “fields”: {fcode: {type, data}} } 5. Save as gzip compressed JSON (.json.gz) 6. If plot_opt is True, display and save signals as subplots

EXCLUDED_FIELD_CODES

data
EXCLUDED_FIELD_CODES = set({110, 111, 112, 113})

FAST_DT

data
FAST_DT = 4e-06

FAST_SPAN_S

data
FAST_SPAN_S = 0.1

get_all_field_codes_for_shot

function source
get_all_field_codes_for_shot(shot: int, max_retries: int = 3)

Returns all field codes used in the given shot.

init_pool

function source
init_pool() -> None

Initialize the global MySQLConnectionPool.

KEY_FILE

data
KEY_FILE = '/home/runner/.vest/encryption_key.key'

last_shot

function source
last_shot() -> int

Returns the maximum shotCode from the shot table.

list_shots

function source
list_shots(*, shot_min: int | None = None, shot_max: int | None = None, start_date: str | date | None = None, end_date: str | date | None = None) -> list[tuple[int, datetime]]

Return (shotNumber, recordDateTime) pairs from the SQL shot table.

load

function source
load(shot: int, field: int, max_retries: int = 3)

Legacy alias kept for existing machine_mapping wrappers.

load_or_generate_key

function source
load_or_generate_key() -> bytes

Load or generate an encryption key.

load_raw

function source
load_raw(shot: int, fields: Optional[Union[int, List[int]]] = None, max_retries: int = 3, daq_type: Optional[int] = None, sample_opt: bool | RawSource = False) -> Optional[Tuple[np.ndarray, np.ndarray]]

High-level data loader for the VEST database.

MAX_RETRIES

data
MAX_RETRIES = 3

MixedCadenceError

class source

Fields with different sampling cadences were batch-loaded together.

name

function source
name(field: int) -> tuple

Retrieves the shotDataFieldName and shotDataFieldRemark from the ‘shotDataField’ table for a given field code.

plot

function source
plot(shots, fields, semilogy_opt: bool = False, norm_opt: bool = False, xlims=None, *, ax=None, show: bool = True)

Plots raw waveforms for the 3 standard scenarios:

POOL_SIZE

data
POOL_SIZE = 4

RawSignalUnavailableError

class source
RawSignalUnavailableError(shot: int, field: int | str, reason: str, *, signal_name: str | None = None) -> None

Raised when a required VEST raw waveform is absent or unusable.

RawSource

data
RawSource = <typing.Union>

require_signal

function source
require_signal(loaded: Optional[Tuple[np.ndarray, np.ndarray]], *, shot: int, field: int | str, signal_name: str | None = None, min_samples: int = 2) -> Tuple[np.ndarray, np.ndarray]

Validate and return a required single-channel raw waveform.

SecureConfigManager

class source
SecureConfigManager()
4 members
  • encrypt method source
  • decrypt method source
  • get_info method — Prompt user for database configuration and save to YAML. source
  • load_config method — Load database configuration from YAML file. source

setup_raw_db

function source
setup_raw_db() -> None

Initialize database configuration.

shots_from_date

function source
shots_from_date(date_str: str) -> list

Returns a list of shotNumbers for the given date (YYYY-MM-DD).

SLOW_DT

data
SLOW_DT = 4e-05

SLOW_DT_THRESHOLD

data
SLOW_DT_THRESHOLD = 5e-06

SLOW_SPAN_S

data
SLOW_SPAN_S = 1.0

sql_loading_available

function source
sql_loading_available() -> bool

Return whether SQL-backed waveform loading is available in this env.

SQL_TABLE_PATH

data
SQL_TABLE_PATH = <pathlib.PosixPath>

upgrade_archive_timebase

function source
upgrade_archive_timebase(payload: dict) -> dict

Add self-describing t0/dt entries to a legacy raw archive.

V2_LAST_SHOT

data
V2_LAST_SHOT = 42190

vest_check_table

function source
vest_check_table(mydb: Any, shot: int) -> int

Return the waveform table generation used by a shot.

vest_connection_pool

function source
vest_connection_pool(pool_size: int = 4) -> None

Compatibility wrapper for donor-style SQL pool initialization.

vest_date

function source
vest_date(shot: int) -> Optional[str]

Return shot date as YYYY-MM-DD.

vest_load

function source
vest_load(shot: int, field: int, max_retries: int = 3, sample_opt: bool | RawSource = False) -> Optional[Tuple[np.ndarray, np.ndarray]]

Compatibility wrapper for donor-style single-signal loading.

vest_load_by_name

function source
vest_load_by_name(shot: int, name: str, sample_opt: bool | RawSource = False) -> Optional[Tuple[np.ndarray, np.ndarray]]

Load a waveform by signal name using the shipped lookup table.

Also exported as vaft.database.raw.vest_loadn.

vest_load_shot_waveform_2

function source
vest_load_shot_waveform_2(mydb: Any, shot: int, field: int) -> Tuple[np.ndarray, np.ndarray]

Compatibility wrapper for donor-style waveform table 2 access.

Also exported as vaft.database.raw.vest_load_shotWaveform_2.

vest_load_shot_waveform_3

function source
vest_load_shot_waveform_3(mydb: Any, shot: int, field: int) -> Tuple[np.ndarray, np.ndarray]

Compatibility wrapper for donor-style waveform table 3 access.

Also exported as vaft.database.raw.vest_load_shotWaveform_3.

vest_shots

function source
vest_shots(date: str) -> list[int]

Return shot list for a date string.

vestdb_is_data_exist

function source
vestdb_is_data_exist(shot_code: int, shot_data_field_code: int) -> bool

Return whether a signal exists for a shot in raw storage.

waveform_generation_for_shot

function source
waveform_generation_for_shot(conn: Any, shot: int) -> Optional[int]

Return which waveform table holds shot, or None if neither does.

vaft.database.replication

Replicate finalized canonical FileDB products into a named HSDS source.

is_reusable

function source
is_reusable(record: ReplicationRecord | None, *, product_sha256: str, require_validation: bool) -> bool

Whether a recorded replication still stands for the current product.

merge_remote_master

function source
merge_remote_master(source: str, shot: int, previous_master: Path | None) -> tuple[str, ...]

Fold a pre-write master’s links back into the one the write just left.

NOTHING_TO_REPLICATE_STATUSES

data
NOTHING_TO_REPLICATE_STATUSES = frozenset({'no_output'})

ProductNotEligibleError

class source

Raised when the local stage product is not finished enough to send.

read_record

function source
read_record(path: Path) -> ReplicationRecord | None

Return a previously written record, or None when there is none.

REPLICABLE_STATUSES

data
REPLICABLE_STATUSES = frozenset({'completed', 'partial', 'success'})

replicate_stage

function source
replicate_stage(stage: str | OMASStage, shot: int, *, filedb: FileDB, family: str = 'magnetic', refinement: str = 'chease', product: str | None = None, attempts: int = 3, retry_delay: float = 5.0, validate: bool = True, force: bool = False) -> ReplicationRecord

Replicate one completed canonical FileDB stage product into HSDS.

REPLICATION_SCHEMA_VERSION

data
REPLICATION_SCHEMA_VERSION = 1

ReplicationError

class source

Raised when a stage product cannot be replicated.

ReplicationRecord

class source
ReplicationRecord(stage: str, shot: int, source: str, remote_uri: str, ids: tuple[str, ...], occurrence: int, product_sha256: str, state: str, attempts: int, started_at: str, completed_at: str | None = None, round_trip: dict[str, Any] | None = None, error: str | None = None, schema_version: int = 1, vaft_version: str = <factory>) -> None

What happened when one stage product was sent to a named HSDS source.

15 fields · 3 members
  • stage: str
  • shot: int
  • source: str
  • remote_uri: str
  • ids: tuple[str, ...]
  • occurrence: int
  • product_sha256: str
  • state: str
  • attempts: int
  • started_at: str
  • completed_at: str | None
  • round_trip: dict[str, Any] | None
  • error: str | None
  • schema_version: int
  • vaft_version: str
  • replicated property source
  • validated property source
  • to_dict method source

RoundTripValidationError

class source

Raised when the replica does not match what was sent.

StageNotReplicableError

class source

Raised when a stage has no destination or no wired rule.

write_record

function source
write_record(record: ReplicationRecord, path: Path) -> Path

vaft.database.retirement

Retiring the combined chease-mhd-stability source (#94, #527 step 9).

copy_refinement

function source
copy_refinement(shot: int, *, source: str = 'chease-mhd-stability', apply: bool = False) -> dict[str, Any]

Copy one shot’s CHEASE refinement into main/chease, verified.

delete_retired_source

function source
delete_retired_source(report: RetirementReport, *, apply: bool = False) -> dict[str, Any]

Delete the combined source, only once its report says nothing is lost.

plan_retirement

function source
plan_retirement(shots: Iterable[int], *, products: Iterable[str] = ('dcon-peeling', 'dcon-kink', 'rdcon', 'stride'), source: str = 'chease-mhd-stability') -> RetirementReport

Say what each shot still needs before the combined source can go.

REFINEMENT_DESTINATION

data
REFINEMENT_DESTINATION = 'main/chease'

REFINEMENT_IDS

data
REFINEMENT_IDS = ('equilibrium',)

RetirementError

class source

Raised when a source cannot be retired safely.

RetirementReport

class source
RetirementReport(source: str, applied: bool, shots: tuple[ShotRetirement, ...], unexamined: tuple[int, ...] = (), enumeration_error: str | None = None) -> None

Whether the combined source still holds anything unique.

5 fields · 3 members
  • source: str
  • applied: bool
  • shots: tuple[ShotRetirement, ...]
  • unexamined: tuple[int, ...]
  • enumeration_error: str | None
  • deletable property — True only when every shot the source holds is accounted for. source
  • blocking property source
  • to_dict method source

RETIRING_SOURCE

data
RETIRING_SOURCE = 'chease-mhd-stability'

ShotRetirement

class source
ShotRetirement(shot: int, refinement: str, stability: str, detail: str) -> None

What stands between one shot and the old source being deletable.

4 fields · 2 members
  • shot: int
  • refinement: str
  • stability: str
  • detail: str
  • deletable property — Whether nothing in this shot would be lost by deleting the source. source
  • to_dict method source

STABILITY_IDS

data
STABILITY_IDS = ('mhd_linear', 'ntms')

vaft.database.sources

The named HSDS dataset sources VAFT publishes each analysis lineage to.

ATLAS_LINEAGE_FAMILIES

data
ATLAS_LINEAGE_FAMILIES = <builtins.dict>

CATALOG

data
CATALOG = <builtins.dict>

children

function source
children(name: str, *, environment: Mapping[str, str] | None = None) -> tuple[HSDSSource, ...]

The sources that hang directly beneath name, in catalog order.

DEFAULT_SOURCE

data
DEFAULT_SOURCE = 'main'

describe

function source
describe(name: str, *, environment: Mapping[str, str] | None = None) -> HSDSSource

Return the catalog entry for one resolved namespace name.

EXTRA_SOURCES_VARIABLE

data
EXTRA_SOURCES_VARIABLE = 'VAFT_HSDS_EXTRA_SOURCES'

family_for_atlas_lineage

function source
family_for_atlas_lineage(lineage: str) -> str

The equilibrium family one routine-TGLF lineage name is filed under.

FAMILY_LINEAGE_NAMES

data
FAMILY_LINEAGE_NAMES = <builtins.dict>

FAMILY_SOURCES

data
FAMILY_SOURCES = <builtins.dict>

HSDSSource

class source
HSDSSource(name: str, purpose: str, writable: bool = True, sparse: bool = False, parent: str | None = None, projects_to: str | None = None, transitional_until: str | None = None) -> None

One named HSDS namespace and the lineage it stores.

7 fields · 2 members
  • name: str
  • purpose: str
  • writable: bool
  • sparse: bool
  • parent: str | None
  • projects_to: str | None
  • transitional_until: str | None
  • derived_parent property — The parent implied by the name, which parent must agree with. source
  • ancestors property — Every source that must exist before this one can be created. source

HSDSSourceError

class source

Base error for an unusable HSDS source name.

is_writable

function source
is_writable(name: str, *, environment: Mapping[str, str] | None = None) -> bool

Return whether VAFT may publish into name.

known_sources

function source
known_sources(*, environment: Mapping[str, str] | None = None) -> tuple[HSDSSource, ...]

Return every source a call may name right now, catalog order first.

LEGACY_SOURCE

data
LEGACY_SOURCE = 'public'

MissingSourceError

class source
MissingSourceError(source: str, detail: str = '') -> None

Raised when a named source has no folder on the HSDS deployment.

OccurrenceMigration

class source
OccurrenceMigration(source: str, ids: str, name: str, occurrence: int | None = None, allocated_by: str = 'the #1129 VEST deployment catalog (not assigned yet)') -> None

Where one transitional source’s IDS goes in the #1128/#1129 model.

5 fields
  • source: str
  • ids: str
  • name: str
  • occurrence: int | None
  • allocated_by: str

parse_tglf_configuration

function source
parse_tglf_configuration(name: Any) -> tuple[int, str]

Return (sat_rule, field_model) for a configuration name, or raise.

ReadOnlySourceError

class source

Raised when a write is requested against a read-only source.

replicable_stages

function source
replicable_stages(*, produced_by: str | None = None) -> tuple[str, ...]

Return the stages with a destination and a wired replication rule.

replication_for_stage

function source
replication_for_stage(stage: Any, *, family: str = 'magnetic', refinement: str = 'chease', product: str | None = None) -> StageReplication

Return the replication contract for one canonical FileDB OMAS stage.

resolve

functionDeprecated usage source
resolve(source: str | None = None, *, directory: str | None = None, target: str | None = None, default: str | None = 'main', writable: bool = False, label: str = 'source', stacklevel: int = 3, environment: Mapping[str, str] | None = None) -> str

Resolve one namespace from source and its deprecated aliases.

source_for_stage

function source
source_for_stage(stage: Any, *, family: str = 'magnetic', refinement: str = 'chease', product: str | None = None) -> str

Return the HSDS source a canonical FileDB OMAS stage is replicated into.

STAGE_REPLICATION

data
STAGE_REPLICATION = <builtins.dict>

STAGE_SOURCE

data
STAGE_SOURCE = <builtins.dict>

StageReplication

class source
StageReplication(source: str | None, ids: tuple[str, ...] = (), occurrence: int = 0, note: str = '', deferred_to: str | None = None, optional: bool = False, produced_by: str = 'routine') -> None

How one canonical FileDB OMAS stage reaches a remote backend.

7 fields · 1 members
  • source: str | None
  • ids: tuple[str, ...]
  • occurrence: int
  • note: str
  • deferred_to: str | None
  • optional: bool
  • produced_by: str
  • replicable property — Whether this stage has a destination and a wired rule today. source

tglf_configuration

function source
tglf_configuration(sat_rule: int, field_model: str) -> str

tglf-sat<n>-<field>: the name of one TGLF configuration (#1482).

tglf_configurations

function source
tglf_configurations() -> tuple[str, ...]

Every TGLF configuration name, ordered by SAT rule then field model.

TGLF_FIELD_MODELS

data
TGLF_FIELD_MODELS = ('es', 'em-bper', 'em-bper-bpar')

TGLF_SAT_RULES

data
TGLF_SAT_RULES = (0, 1, 2, 3)

TRANSITIONAL_UNTIL

data
TRANSITIONAL_UNTIL = '#1128/#1129'

turbulent_transport_migration

function source
turbulent_transport_migration() -> tuple[OccurrenceMigration, ...]

Every transitional TGLF source with the occurrence name it migrates to.

turbulent_transport_occurrence_name

function source
turbulent_transport_occurrence_name(family: str, configuration: str) -> str

The future ids_properties.name of one TGLF configuration’s IDS.

turbulent_transport_source

function source
turbulent_transport_source(family: str, configuration: str) -> str

The transitional HSDS source of one TGLF configuration on one family.

UnknownSourceError

class source

Raised when a name is not in the catalog and was not opted into.

vaft.database.staging

Selective, cached materialization of IMAS HDF5 domains from HSDS.

create_partial_master

function source
create_partial_master(source_master: Path, destination_master: Path, requested_ids: Iterable[str]) -> tuple[str, ...]

Copy source_master and retain only requested IDS external links.

external_h5_links

function source
external_h5_links(master_path: Path) -> list[str]

Return filenames referenced by top-level external links in master.

HSDSDomainCache

class source
HSDSDomainCache(directory: str, shot: int, cache: str | Path = 'auto') -> None

Persistent validated cache for HSDS HDF5 images of one shot.

2 members
  • manifest_path property source
  • materialize method — Put one domain file in target_dir and report its transport. source

merge_master_links

function source
merge_master_links(current_master: Path, previous_master: Path | None, *, present_files: Iterable[str]) -> tuple[str, ...]

Fold a previous master’s IDS links back into a freshly written one.

requested_ids_from_paths

function source
requested_ids_from_paths(paths: Iterable[Any] | None) -> tuple[str, ...] | None

Infer requested top-level IDS names from OMAS/IMAS paths.

stage_imas_shot

function source
stage_imas_shot(directory: str, shot: int, staging_dir: Path, *, requested_ids: Iterable[str] | None, cache: str | Path = 'auto', transport: Literal['auto', 'canonical', 'h5image'] = 'auto') -> dict[str, Any]

Materialize a complete or IDS-selective local IMAS HDF5 shot.

vaft.database.transport

Checked subprocess transport for the HSDS command-line tools.

HSDSCommandError

class source
HSDSCommandError(command: str, exit_code: int, detail: str = '') -> None

Raised when an HSDS CLI process exits unsuccessfully.

HSDSCommandNotFoundError

class source

Raised when a required h5pyd CLI executable is not on PATH.

HSDSTransportError

class source

Base error raised when an HSDS command cannot complete.

HSDSTransportVerificationError

class source

Raised when an uploaded domain differs from its local HDF5 source.

run_hsget

function source
run_hsget(remote_uri: str, out_path: str | Path) -> Path

Materialize one remote HSDS domain as a local HDF5 file.

run_hsload

function source
run_hsload(local_path: str | Path, remote_uri: str) -> str

Upload one local HDF5 file as an HSDS domain.

verify_uploaded_image

function source
verify_uploaded_image(local_path: str | Path, remote_uri: str, *, h5pyd_module: object | None = None) -> None

Compare critical IMAS metadata after hsload transcoding.

vaft.database.utils

Common utilities and helper functions for VEST database operations.

CP_REGISTRY_GROUP

data
CP_REGISTRY_GROUP = 'cp_shots'

CX_REGISTRY_GROUP

data
CX_REGISTRY_GROUP = 'cx_shots'

ensure_imas_hdf5_userblock

function source
ensure_imas_hdf5_userblock(path: Union[str, Path], entry_dir: Union[str, Path]) -> None

Repair an IMAS HDF5 image downloaded from HSDS so IMAS-Core can open it.

exist_shot

function source
exist_shot(source: Optional[str] = None, shot: Optional[int] = None, data_filter: Optional[str] = None, sort: int = -1, *, username: Optional[str] = None, strict: bool = False) -> Union[List[str], bool, pd.DataFrame, None]

Return a list of shot names or processed-diagnostic data from HSDS.

is_connect

function source
is_connect() -> bool

Check if the user is connected to the HSDS server.

processed_registry_uri

function source
processed_registry_uri(source: Optional[str] = None, *, writable: bool = False) -> str

Return the legacy corrective-pipeline registry domain for one named source.

read_legacy_processed_registry

function source
read_legacy_processed_registry(group: str) -> dict

Return the legacy public registry entries for one diagnostic group.

require_source_exists

function source
require_source_exists(source: str) -> None

Fail with the administrator fix when a source folder is not there yet.

TS_REGISTRY_GROUP

data
TS_REGISTRY_GROUP = 'shots'

vaft.database.worker.classify

Classify a settled shot before any work is scheduled for it (issue #58).

Classification

class source
Classification(label: str, reason: str, applicable_stages: tuple[str, ...] | None) -> None

Also exported as vaft.database.worker.Classification.

3 fields · 1 members
  • label: str
  • reason: str
  • applicable_stages: tuple[str, ...] | None
  • runnable property source

Classifier

class source
Classifier(*args, **kwargs)

Also exported as vaft.database.worker.Classifier.

1 members

DAQ_MISSING

data
DAQ_MISSING = 'daq_missing'

load_classifier

function source
load_classifier(spec: str | None, pipeline_config: Mapping[str, Any]) -> Classifier

Resolve module:callable to a classifier, or the raw-field default.

RAW_INCOMPLETE

data
RAW_INCOMPLETE = 'raw_incomplete'

RAW_ONLY

data
RAW_ONLY = ('raw',)

RawFieldClassifier

class source
RawFieldClassifier(required_fields: Sequence[int] = (1, 12, 25, 59, 109))

Decide from the SQL field inventory alone.

Also exported as vaft.database.worker.RawFieldClassifier.

2 members
  • from_pipeline_config classmethod source
  • classify method source

ShotObservation

class source
ShotObservation(shot: int, record_datetime: datetime | str | None, field_codes: frozenset[int]) -> None

What SQL says about one settled shot.

Also exported as vaft.database.worker.ShotObservation.

3 fields
  • shot: int
  • record_datetime: datetime | str | None
  • field_codes: frozenset[int]

UNCLASSIFIED

data
UNCLASSIFIED = 'unclassified'

vaft.database.worker.config

Server-only configuration for the new-shot pipeline worker (issue #58).

CONFIG_ENVIRONMENT_VARIABLE

data
CONFIG_ENVIRONMENT_VARIABLE = 'VAFT_WORKER_CONFIG'

load_pipeline_config

function source
load_pipeline_config(config: WorkerConfig) -> dict[str, Any]

The configuration Snakemake will actually run with.

load_worker_config

function source
load_worker_config(path: str | os.PathLike[str] | None = None) -> WorkerConfig

Read the worker configuration from path or $VAFT_WORKER_CONFIG.

Also exported as vaft.database.worker.load_worker_config.

worker_config_from_mapping

function source
worker_config_from_mapping(data: Mapping[str, Any], *, base_dir: Path) -> WorkerConfig

Build a WorkerConfig from parsed YAML.

WorkerConfig

class source
WorkerConfig(state_db: Path, log_dir: Path, workflow_dir: Path, pipeline_config: Path, first_shot: int, poll_interval: float, quiet_seconds: float, cores: int, snakemake_cmd: tuple[str, ...], extra_args: tuple[str, ...] = (), max_shots_per_run: int = 20, max_attempts: int = 3, recheck_seconds: float = 259200.0, max_reprocess: int = 3, run_timeout: float | None = None, env: Mapping[str, str] = <factory>, classifier: str | None = None, record_shot_class: bool = False, stages: tuple[str, ...] | None = None, min_free_gb: float | None = None, resume_free_gb: float | None = None, disk_paths: tuple[Path, ...] = ()) -> None

What one deployment of the worker runs, and where it keeps its state.

Also exported as vaft.database.worker.WorkerConfig.

22 fields · 2 members
  • state_db: Path
  • log_dir: Path
  • workflow_dir: Path
  • pipeline_config: Path
  • first_shot: int
  • poll_interval: float
  • quiet_seconds: float
  • cores: int
  • snakemake_cmd: tuple[str, ...]
  • extra_args: tuple[str, ...]
  • max_shots_per_run: int
  • max_attempts: int
  • recheck_seconds: float
  • max_reprocess: int
  • run_timeout: float | None
  • env: Mapping[str, str]
  • classifier: str | None
  • record_shot_class: bool
  • stages: tuple[str, ...] | None
  • min_free_gb: float | None
  • resume_free_gb: float | None
  • disk_paths: tuple[Path, ...]
  • snakefile property source
  • environment method — The process environment runs see: base overlaid with env. source

WorkerConfigError

class source

Raised when the worker configuration cannot be used.

Also exported as vaft.database.worker.WorkerConfigError.

vaft.database.worker.corrective

The corrective-pipeline worker: run pipeline 2 when a Thomson or CES upload arrives (issue #1842).

CONFIG_ENVIRONMENT_VARIABLE

data
CONFIG_ENVIRONMENT_VARIABLE = 'VAFT_CORRECTIVE_WORKER_CONFIG'

corrective_config_from_mapping

function source
corrective_config_from_mapping(data: Mapping[str, Any], *, base_dir: Path) -> CorrectiveWorkerConfig

Build a CorrectiveWorkerConfig from parsed YAML; relative paths resolve against base_dir.

CorrectiveCycleReport

class source
CorrectiveCycleReport(recovered: list[int] = <factory>, scanned: int = 0, new: list[int] = <factory>, changed: list[int] = <factory>, run_id: int | None = None, run_shots: list[int] = <factory>, busy: bool = False, held: bool = False, scan_error: str | None = None, outcomes: dict[int, str] = <factory>, gave_up: list[int] = <factory>) -> None
11 fields · 1 members
  • recovered: list[int]
  • scanned: int
  • new: list[int]
  • changed: list[int]
  • run_id: int | None
  • run_shots: list[int]
  • busy: bool
  • held: bool
  • scan_error: str | None
  • outcomes: dict[int, str]
  • gave_up: list[int]
  • to_dict method source

CorrectiveHarvester

class source
CorrectiveHarvester(pipeline_config: Mapping[str, Any], *, paths_workflow_dir: Path, environment: Mapping[str, str] | None = None)

Judge each shot by the manifests of the stages in scope, never by an exit code.

2 members

CorrectivePlan

class source
CorrectivePlan(run_id: int, full_shots: tuple[int, ...], file_targets: tuple[str, ...] = (), force: bool = False) -> None

A RunPlan that may force the root rules (a changed or failed shot is not up to date).

4 fields
  • run_id: int
  • full_shots: tuple[int, ...]
  • file_targets: tuple[str, ...]
  • force: bool

CorrectiveRunner

class source
CorrectiveRunner(config: WorkerConfig, pipeline_config: Mapping[str, Any])

The routine worker’s runner, plus --forcerun on the two root rules when the plan asks.

1 members

CorrectiveState

class source
CorrectiveState(path: str | os.PathLike[str], *, read_only: bool = False)

The corrective worker’s SQLite file: one row per shot with an upload, plus runs and events.

19 members
  • close method source
  • event method source
  • observe method — Record what the scan saw; returns "new", "changed" or None (nothing new). source
  • ready method — Pending shots whose newest file is at least quiet_seconds old, lowest shot first. source
  • new_run method source
  • note_process method source
  • finish_run method source
  • record_stages method source
  • settle method — Give a shot its post-run state; a change made while it ran sends it back to pending. source
  • release method — Put shots back to pending without counting an attempt (busy workflow, stop request). source
  • recover method — Shots a killed worker left running go back to pending (forced: their outputs may be incomplete). source
  • unfinished_runs method source
  • requeue method source
  • exclude method source
  • shot method source
  • shots method source
  • counts method source
  • stage_status method source
  • events method source

CorrectiveWorker

class source
CorrectiveWorker(config: CorrectiveWorkerConfig, *, state: CorrectiveState | None = None, scanner: Any = None, runner: Any = None, harvester: CorrectiveHarvester | None = None, pipeline_config: Mapping[str, Any] | None = None, clock: Callable[[], datetime] = <built-in method now of type object>)

Watch the uploads, run pipeline 2, harvest. Collaborators are injectable for tests.

8 members
  • recover method source
  • scan method source
  • held method source
  • run_batch method source
  • settle method — Judge one shot from its manifests – unless the run did not finish. source
  • run_cycle method source
  • run_forever method source
  • stop method source

CorrectiveWorkerConfig

class source
CorrectiveWorkerConfig(state_db: Path, log_dir: Path, workflow_dir: Path, pipeline_config: Path, paths_workflow_dir: Path, first_shot: int, poll_interval: float, quiet_seconds: float, cores: int, snakemake_cmd: tuple[str, ...], last_shot: int | None = None, extra_args: tuple[str, ...] = (), max_shots_per_run: int = 20, max_attempts: int = 3, run_timeout: float | None = None, env: Mapping[str, str] = <factory>, stages: tuple[str, ...] | None = None, hold_file: Path | None = None) -> None

What one deployment of the corrective worker runs, and where it keeps its state.

18 fields · 2 members
  • state_db: Path
  • log_dir: Path
  • workflow_dir: Path
  • pipeline_config: Path
  • paths_workflow_dir: Path
  • first_shot: int
  • poll_interval: float
  • quiet_seconds: float
  • cores: int
  • snakemake_cmd: tuple[str, ...]
  • last_shot: int | None
  • extra_args: tuple[str, ...]
  • max_shots_per_run: int
  • max_attempts: int
  • run_timeout: float | None
  • env: Mapping[str, str]
  • stages: tuple[str, ...] | None
  • hold_file: Path | None
  • snakefile property source
  • environment method source

load_corrective_config

function source
load_corrective_config(path: str | os.PathLike[str] | None = None) -> CorrectiveWorkerConfig

Read the configuration from path or $VAFT_CORRECTIVE_WORKER_CONFIG.

load_corrective_pipeline_config

function source
load_corrective_pipeline_config(config: CorrectiveWorkerConfig) -> dict[str, Any]

The configuration Snakemake will run with: the workflow’s own, overlaid by the deployment’s.

read_corrective_state

function source
read_corrective_state(path: str | os.PathLike[str]) -> Iterator[CorrectiveState]

Open the state file read-only, for monitoring.

SHOT_STATES

data
SHOT_STATES = ('pending', 'running', 'completed', 'unavailable', 'failed', 'gave_up', 'excluded')

ShotOutcome

class source
ShotOutcome(state: str, reason: str, stages: tuple[StageStatus, ...]) -> None
3 fields
  • state: str
  • reason: str
  • stages: tuple[StageStatus, ...]

UploadScanner

class source
UploadScanner(data_root: str | os.PathLike[str])

List the Thomson and CES uploads under data_root and group them by shot.

1 members
  • scan method — Every shot with an upload. Raises OSError if the root cannot be read. source

UploadSignature

class source
UploadSignature(files: tuple[tuple[str, int, int], ...]) -> None

The files uploaded for one shot, as (relative name, size, mtime_ns).

1 fields · 2 members
  • files: tuple[tuple[str, int, int], ...]
  • newest_mtime property source
  • digest property source

vaft.database.worker.poll

Where the worker learns about new shots: the VEST SQL shot table (issue #58).

MATCH_QUIET_SECONDS

data
MATCH_QUIET_SECONDS = 30.0

require_sql_credentials

function source
require_sql_credentials() -> None

Refuse to start without provisioned SQL credentials.

ShotSource

class source
ShotSource(*args, **kwargs)
3 members
  • new_shots method — (shot, recordDateTime) for every shot numbered above after. source
  • upload_status method — Field codes recorded for shot and seconds since its last upload. source
  • field_codes_by_shot method — Field codes currently recorded for each of shots. source

SqlShotSource

class source
SqlShotSource() -> None

The live VEST SQL database.

3 members

upload_finished

function source
upload_finished(*, field_codes: frozenset[int], reference: frozenset[int] | None, quiet_seconds: float | None, quiet_limit: float) -> str | None

Why a shot’s upload counts as finished, or None while it may continue.

vaft.database.worker.runner

Run the routine Snakemake pipeline for a batch of shots (issue #58).

live_snakemake_in

function source
live_snakemake_in(workflow_dir: Path) -> bool | None

Is any Snakemake process working in workflow_dir right now?

RunPlan

class source
RunPlan(run_id: int, full_shots: tuple[int, ...], file_targets: tuple[str, ...] = ()) -> None
3 fields · 1 members
  • run_id: int
  • full_shots: tuple[int, ...]
  • file_targets: tuple[str, ...]
  • shots_label property source

RunResult

class source
RunResult(exit_code: int | None, log_path: str, busy: bool = False, timed_out: bool = False, interrupted: bool = False) -> None
5 fields
  • exit_code: int | None
  • log_path: str
  • busy: bool
  • timed_out: bool
  • interrupted: bool

SnakemakeRunner

class source
SnakemakeRunner(config: WorkerConfig, pipeline_config: Mapping[str, Any])

Builds and runs the Snakemake command for a RunPlan.

7 members
  • run_dir method source
  • write_configfile method — The pipeline config with shots replaced by this run’s batch. source
  • base_command method source
  • command method source
  • run method source
  • stop method — Ask a running Snakemake to stop gracefully (called from a signal handler). source
  • unlock_if_stale method — --unlock the workflow directory only if no Snakemake works in it. source

vaft.database.worker.service

The new-shot pipeline worker’s cycle (issue #58).

CycleReport

class source
CycleReport(recovered: list[int] = <factory>, detected: list[int] = <factory>, queued: list[int] = <factory>, excluded: list[int] = <factory>, run_id: int | None = None, run_shots: list[int] = <factory>, busy: bool = False, outcomes: dict[int, str] = <factory>, gave_up: list[int] = <factory>, reprocessed: list[int] = <factory>, disk_paused: str | None = None) -> None

Also exported as vaft.database.worker.CycleReport.

11 fields · 1 members
  • recovered: list[int]
  • detected: list[int]
  • queued: list[int]
  • excluded: list[int]
  • run_id: int | None
  • run_shots: list[int]
  • busy: bool
  • outcomes: dict[int, str]
  • gave_up: list[int]
  • reprocessed: list[int]
  • disk_paused: str | None
  • to_dict method source

PipelineWorker

class source
PipelineWorker(config: WorkerConfig, *, state: S.WorkerState | None = None, source: ShotSource | None = None, classifier: Classifier | None = None, runner: Runner | None = None, harvester: PipelineHarvester | None = None, pipeline_config: Mapping[str, Any] | None = None, clock: Callable[[], datetime] = <built-in method now of type object>, disk_free: Callable[[str], int] = <function PipelineWorker.<lambda>>)

Poll SQL, classify, run and harvest. Collaborators are injectable for tests.

Also exported as vaft.database.worker.PipelineWorker.

11 members
  • recover method — Undo what a previous worker left mid-run; see WorkerState.recover. source
  • detect method source
  • settle method — Classify every detected shot whose upload has finished; see .poll. source
  • recheck method — Reprocess recently settled shots whose SQL inventory has grown since. source
  • guarded_paths method source
  • disk_shortage method — Why a new batch must not start for lack of disk space, or None. source
  • guard_disk method — Pause (or resume) on free disk space; True when a batch may start. source
  • run_batch method source
  • run_cycle method source
  • stop method source
  • run_forever method — Cycle until stop; the first cycle recovers a crashed predecessor. source

vaft.database.worker.state

Durable state of the new-shot pipeline worker (issue #58).

COMPLETED

data
COMPLETED = 'completed'

DETECTED

data
DETECTED = 'detected'

EXCLUDED

data
EXCLUDED = 'excluded'

FAILED

data
FAILED = 'failed'

GAVE_UP

data
GAVE_UP = 'gave_up'

PARTIAL

data
PARTIAL = 'partial'

QUEUED

data
QUEUED = 'queued'

read_worker_state

function source
read_worker_state(path: str | os.PathLike[str]) -> WorkerState

Open a worker’s state read-only – the monitoring entry point (#1347).

Also exported as vaft.database.worker.read_worker_state.

RUNNING

data
RUNNING = 'running'

SHOT_STATES

data
SHOT_STATES = ('detected', 'queued', 'running', 'completed', 'partial', 'excluded', 'failed', 'gave_up')

Also exported as vaft.database.worker.SHOT_STATES.

WorkerState

class source
WorkerState(path: str | os.PathLike[str], *, readonly: bool = False)

The worker’s SQLite store. Every mutation is one transaction.

Also exported as vaft.database.worker.WorkerState.

29 members
  • close method source
  • watermark method — The largest shot ever detected, or default before the first. source
  • add_detected method — Insert newly seen shots; return those that were not already known. source
  • reference_fields method — The inventory of the latest settled shot below before, if any. source
  • set_field_codes method — Record the inventory a shot was processed with – the re-check baseline. source
  • recheck_candidates method — Settled, not running, not operator-excluded, settled after since. source
  • reopen method — Late fields arrived: observe, classify and run the shot again. source
  • settle method — Move a detected shot to queued or excluded with its verdict. source
  • runnable method — Queued shots, then failed shots with attempts left, oldest shot first. source
  • start_run method — Open a run and mark its shots running. source
  • record_run_process method source
  • finish_run method source
  • unfinished_runs method source
  • conclude method — Record a run’s verdict for one shot. source
  • give_up_exhausted method — Move failed shots that have used every attempt to gave_up. source
  • set_reference_class method source
  • record_stage_status method — Replace the per-stage status rows the harvest found for shot. source
  • recover method — Return shots a crashed worker left running to queued. source
  • requeue method — Operator retry: queue shot again with a fresh attempt budget. source
  • exclude method — Operator exclusion: never schedule shot again. source
  • shot method source
  • shots method source
  • stage_status method source
  • runs method source
  • events method source
  • disk_paused method — Why the worker paused for disk space, or None while it runs. source
  • set_disk_paused method — Enter (reason) or leave (None) the disk pause, with an event. source
  • counts method source
  • event method source

vaft.database.worker.status

Read back what a pipeline run left for each shot (issue #58).

load_pipeline_paths_module

function source
load_pipeline_paths_module(workflow_dir: Path) -> ModuleType

Import the workflow’s paths.py from the configured checkout.

MANIFEST

data
MANIFEST = 'manifest'

MISSING

data
MISSING = 'missing'

OK_STATUSES

data
OK_STATUSES = frozenset({'completed', 'present', 'success', 'validated'})

PipelineHarvester

class source
PipelineHarvester(pipeline_config: Mapping[str, Any], *, workflow_dir: Path, environment: Mapping[str, str] | None = None)

Evaluate each shot against the routine pipeline’s declared products.

9 members
  • in_scope method source
  • raw_targets method source
  • raw_output_files method — The files that make up the raw stage – Snakemake targets for a raw-only shot. source
  • targets method — Every product rule all requests for an eligible shot, within the stage scope. source
  • plot_targets method — The Snakefile’s validation_plot_products for one shot. source
  • read staticmethod source
  • dumped_field_codes method — The field codes the raw dump holds, from its manifest’s inventory. source
  • preflight_exclusion method — The raw preflight’s reason for excluding shot, if it did. source
  • harvest method — The shot’s state after a run, with the status of each declared product. source

REPLICATION

data
REPLICATION = 'replication'

ShotOutcome

class source
ShotOutcome(state: str, reason: str, stages: tuple[StageStatus, ...]) -> None
3 fields
  • state: str
  • reason: str
  • stages: tuple[StageStatus, ...]

StageStatus

class source
StageStatus(stage: str, product: str | None, kind: str, status: str, path: str) -> None
5 fields · 1 members
  • stage: str
  • product: str | None
  • kind: str
  • status: str
  • path: str
  • label property source

StageTarget

class source
StageTarget(stage: str, product: str | None, kind: str, path: str) -> None
4 fields
  • stage: str
  • product: str | None
  • kind: str
  • path: str

results matching ""

    No results matching ""