simstack.models package¶
Submodules¶
simstack.models.array_list module¶
- class simstack.models.array_list.ArrayList(*, elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[ArrayStorage]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.array_storage module¶
- class simstack.models.array_storage.ArrayStorage(*, name: str | None, shape: str | None = None, field_name: str | None = None, data_json: str | None = None, id: ObjectId = <factory>)[source]¶
Bases:
BytesB64Mixin,Model- property array¶
Property getter for array
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data_json: str | None = <odmantic.field.FieldProxy object>¶
- field_name: str | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bytes'>: <function BytesB64Mixin.<lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str | None = <odmantic.field.FieldProxy object>¶
- shape: str | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
simstack.models.artifact_models module¶
- class simstack.models.artifact_models.ArtifactMapping(*, name: str = 'artifact', regex_pattern: str = '', function_mapping: str = '', function_code: str = '', pickle_function: FunctionPickle | None = None, id: ObjectId = <factory>)¶
Bases:
ModelArtifactsMapper is a mapping between the artifact and a node registry-path. The workflow executor passes a path of the type
node1.node2.node4. … .nodeN
where node is the function name of the node
Regex can maps this to the target path of the ArtifactsMapping, e.g. a path
*.parent1.node
it would map on all nodes with name node that have been directly called by a node with the name parent1.
- function_code: str = <odmantic.field.FieldProxy object>¶
- function_mapping: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- pickle_function: FunctionPickle | None = <odmantic.field.FieldProxy object>¶
- regex_pattern: str = <odmantic.field.FieldProxy object>¶
- set_values(other: ArtifactMapping) ArtifactMapping¶
- class simstack.models.artifact_models.ArtifactModel(*, name: str, description: str | None = None, data: dict[str, ~typing.Any]=<factory>, path: str | None = None, id: ObjectId = <factory>)¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': 'artifacts', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- path: str | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.base_lists module¶
- class simstack.models.base_lists.BooleanDataList(*, field_name: str = 'boolean_data_list', elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[StringData]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.base_lists.StringDataList(*, field_name: str = 'string_data_list', elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[StringData]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.base_lists.StringList(*, field_name: str = 'string_list', elements: list[str] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,GenericListMixin[str]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[str] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.base_types module¶
- class simstack.models.base_types.BinaryOperationInput(*, field_name: str = 'binary_operation', arg1: FloatData, arg2: FloatData, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.base_types.BooleanData(*, field_name: str = 'boolean', value: bool, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: bool = <odmantic.field.FieldProxy object>¶
- class simstack.models.base_types.FloatData(*, field_name: str = 'float', value: float, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: float = <odmantic.field.FieldProxy object>¶
- class simstack.models.base_types.IntData(*, field_name: str = 'int', value: int, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: int = <odmantic.field.FieldProxy object>¶
- class simstack.models.base_types.IteratorInput(*, start: int, stop: int, generator: str = 'range', id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- generator: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- start: int = <odmantic.field.FieldProxy object>¶
- stop: int = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.base_types.StringData(*, field_name: str = 'text', value: str, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: str = <odmantic.field.FieldProxy object>¶
simstack.models.charts_artifact module¶
- class simstack.models.charts_artifact.AGAreaSeriesConfig(*, type: Literal['area'] = 'area', xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, fillOpacity: float | None = 0.8, strokeWidth: float | None = 2, marker: dict[str, ~typing.Any] | None=None, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
AGChartSeriesBaseAG-Charts area series configuration.
- fillOpacity: float | None = <odmantic.field.FieldProxy object>¶
- marker: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bson.decimal128.Decimal128'>: <function <lambda>>, <class 'bson.objectid.ObjectId'>: <class 'str'>, <class 'bson.regex.Regex'>: <function <lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- strokeWidth: float | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['area'] = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGBarSeriesConfig(*, type: Literal['bar'] = 'bar', xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, fillOpacity: float | None = 1, strokeWidth: float | None = 0, cornerRadius: float | None = 0, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
AGChartSeriesBaseAG-Charts bar series configuration.
- cornerRadius: float | None = <odmantic.field.FieldProxy object>¶
- fillOpacity: float | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bson.decimal128.Decimal128'>: <function <lambda>>, <class 'bson.objectid.ObjectId'>: <class 'str'>, <class 'bson.regex.Regex'>: <function <lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- strokeWidth: float | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['bar'] = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGChartAxisConfig(*, type: Literal['category', 'number', 'time', 'log'], position: Literal['top', 'right', 'bottom', 'left'], title: str | None = None, min: float | None = None, max: float | None = None, tick: dict[str, Any] | None = None, label: dict[str, Any] | None = None, gridStyle: list[dict[str, Any]] | None = None)[source]¶
Bases:
EmbeddedModelAG-Charts axis configuration.
- gridStyle: list[dict[str, Any]] | None = <odmantic.field.FieldProxy object>¶
- label: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- max: float | None = <odmantic.field.FieldProxy object>¶
- min: float | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- position: Literal['top', 'right', 'bottom', 'left'] = <odmantic.field.FieldProxy object>¶
- tick: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- title: str | None = <odmantic.field.FieldProxy object>¶
- type: Literal['category', 'number', 'time', 'log'] = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGChartFrameConfig(*, enabled: bool = True, stroke: str = 'black', strokeWidth: float = 1, cornerRadius: float = 0, opacity: float = 1)[source]¶
Bases:
EmbeddedModelAG-Charts frame (border) configuration.
- cornerRadius: float = <odmantic.field.FieldProxy object>¶
- enabled: bool = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- opacity: float = <odmantic.field.FieldProxy object>¶
- stroke: str = <odmantic.field.FieldProxy object>¶
- strokeWidth: float = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGChartLegendConfig(*, enabled: bool = True, position: Literal['top', 'right', 'bottom', 'left']='right', spacing: float = 20, item: dict[str, ~typing.Any]=<factory>)[source]¶
Bases:
EmbeddedModelAG-Charts legend configuration.
- enabled: bool = <odmantic.field.FieldProxy object>¶
- item: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- position: Literal['top', 'right', 'bottom', 'left'] = <odmantic.field.FieldProxy object>¶
- spacing: float = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGChartSeriesBase(*, type: str, xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>)[source]¶
Bases:
EmbeddedModelBase class for AG-Charts series configuration.
- data: list[dict[str, Any]] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- showInLegend: bool | None = <odmantic.field.FieldProxy object>¶
- title: str | None = <odmantic.field.FieldProxy object>¶
- type: str = <odmantic.field.FieldProxy object>¶
- visible: bool | None = <odmantic.field.FieldProxy object>¶
- xKey: str = <odmantic.field.FieldProxy object>¶
- yKey: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGChartSubtitleConfig(*, text: str, fontSize: int | None = 12, color: str | None = None)[source]¶
Bases:
EmbeddedModelAG-Charts subtitle configuration.
- color: str | None = <odmantic.field.FieldProxy object>¶
- fontSize: int | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- text: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGChartTitleConfig(*, text: str = 'Chart Title')[source]¶
Bases:
EmbeddedModelAG-Charts title configuration.
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- text: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGColumnSeriesConfig(*, type: Literal['column'] = 'column', xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, fillOpacity: float | None = 1, strokeWidth: float | None = 0, cornerRadius: float | None = 0, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
AGChartSeriesBaseAG-Charts column series configuration.
- cornerRadius: float | None = <odmantic.field.FieldProxy object>¶
- fillOpacity: float | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bson.decimal128.Decimal128'>: <function <lambda>>, <class 'bson.objectid.ObjectId'>: <class 'str'>, <class 'bson.regex.Regex'>: <function <lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- strokeWidth: float | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['column'] = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGDonutSeriesConfig(*, type: Literal['donut'] = 'donut', angleKey: str, radiusKey: str | None = None, labelKey: str | None = None, legendItemKey: str | None = None, calloutLabelKey: str | None = None, sectorLabelKey: str | None = None, innerRadiusRatio: float | None = 0.6, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, tooltip: dict[str, Any] | None = None)[source]¶
Bases:
EmbeddedModelAG-Charts donut series configuration.
- angleKey: str = <odmantic.field.FieldProxy object>¶
- calloutLabelKey: str | None = <odmantic.field.FieldProxy object>¶
- innerRadiusRatio: float | None = <odmantic.field.FieldProxy object>¶
- labelKey: str | None = <odmantic.field.FieldProxy object>¶
- legendItemKey: str | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- radiusKey: str | None = <odmantic.field.FieldProxy object>¶
- sectorLabelKey: str | None = <odmantic.field.FieldProxy object>¶
- showInLegend: bool | None = <odmantic.field.FieldProxy object>¶
- title: str | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['donut'] = <odmantic.field.FieldProxy object>¶
- visible: bool | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGHeatmapSeriesConfig(*, type: Literal['heatmap'] = 'heatmap', xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, colorKey: str, xName: str | None = None, yName: str | None = None, colorName: str | None = None, colorRange: list[str] | None = None, colorDomain: list[float] | None = None, stroke: str | None = None, strokeWidth: float | None = None, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
AGChartSeriesBaseAG-Charts heatmap series configuration.
- colorDomain: list[float] | None = <odmantic.field.FieldProxy object>¶
- colorKey: str = <odmantic.field.FieldProxy object>¶
- colorName: str | None = <odmantic.field.FieldProxy object>¶
- colorRange: list[str] | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bson.decimal128.Decimal128'>: <function <lambda>>, <class 'bson.objectid.ObjectId'>: <class 'str'>, <class 'bson.regex.Regex'>: <function <lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- stroke: str | None = <odmantic.field.FieldProxy object>¶
- strokeWidth: float | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['heatmap'] = <odmantic.field.FieldProxy object>¶
- xName: str | None = <odmantic.field.FieldProxy object>¶
- yName: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGLineSeriesConfig(*, type: Literal['line'] = 'line', xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, strokeWidth: float | None = 2, strokeOpacity: float | None = 1, lineDash: list[float] | None = None, marker: dict[str, ~typing.Any] | None=None, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
AGChartSeriesBaseAG-Charts line series configuration.
- lineDash: list[float] | None = <odmantic.field.FieldProxy object>¶
- marker: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bson.decimal128.Decimal128'>: <function <lambda>>, <class 'bson.objectid.ObjectId'>: <class 'str'>, <class 'bson.regex.Regex'>: <function <lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- strokeOpacity: float | None = <odmantic.field.FieldProxy object>¶
- strokeWidth: float | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['line'] = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGPieSeriesConfig(*, type: Literal['pie'] = 'pie', angleKey: str, radiusKey: str | None = None, labelKey: str | None = None, legendItemKey: str | None = None, calloutLabelKey: str | None = None, sectorLabelKey: str | None = None, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, tooltip: dict[str, ~typing.Any] | None=None, data: list[dict[str, ~typing.Any]]=<factory>)[source]¶
Bases:
EmbeddedModelAG-Charts pie series configuration.
- angleKey: str = <odmantic.field.FieldProxy object>¶
- calloutLabelKey: str | None = <odmantic.field.FieldProxy object>¶
- data: list[dict[str, Any]] = <odmantic.field.FieldProxy object>¶
- labelKey: str | None = <odmantic.field.FieldProxy object>¶
- legendItemKey: str | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- radiusKey: str | None = <odmantic.field.FieldProxy object>¶
- sectorLabelKey: str | None = <odmantic.field.FieldProxy object>¶
- showInLegend: bool | None = <odmantic.field.FieldProxy object>¶
- title: str | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['pie'] = <odmantic.field.FieldProxy object>¶
- visible: bool | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGRangeBarSeriesConfig(*, type: Literal['range-bar'] = 'range-bar', xKey: str, yLowKey: str, yHighKey: str, xName: str | None = None, yName: str | None = None, yLowName: str | None = None, yHighName: str | None = None, direction: Literal['horizontal', 'vertical'] | None=None, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, fillOpacity: float | None = 1, strokeWidth: float | None = 0, cornerRadius: float | None = 0, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
EmbeddedModelAG-Charts range-bar series configuration.
- cornerRadius: float | None = <odmantic.field.FieldProxy object>¶
- data: list[dict[str, Any]] = <odmantic.field.FieldProxy object>¶
- direction: Literal['horizontal', 'vertical'] | None = <odmantic.field.FieldProxy object>¶
- fillOpacity: float | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- showInLegend: bool | None = <odmantic.field.FieldProxy object>¶
- strokeWidth: float | None = <odmantic.field.FieldProxy object>¶
- title: str | None = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['range-bar'] = <odmantic.field.FieldProxy object>¶
- visible: bool | None = <odmantic.field.FieldProxy object>¶
- xKey: str = <odmantic.field.FieldProxy object>¶
- xName: str | None = <odmantic.field.FieldProxy object>¶
- yHighKey: str = <odmantic.field.FieldProxy object>¶
- yHighName: str | None = <odmantic.field.FieldProxy object>¶
- yLowKey: str = <odmantic.field.FieldProxy object>¶
- yLowName: str | None = <odmantic.field.FieldProxy object>¶
- yName: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.AGScatterSeriesConfig(*, type: Literal['scatter'] = 'scatter', xKey: str, yKey: str, visible: bool | None = True, showInLegend: bool | None = True, title: str | None = None, data: list[dict[str, ~typing.Any]]=<factory>, marker: dict[str, ~typing.Any] | None=None, tooltip: dict[str, ~typing.Any] | None=None)[source]¶
Bases:
AGChartSeriesBaseAG-Charts scatter series configuration.
- marker: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bson.decimal128.Decimal128'>: <function <lambda>>, <class 'bson.objectid.ObjectId'>: <class 'str'>, <class 'bson.regex.Regex'>: <function <lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- type: Literal['scatter'] = <odmantic.field.FieldProxy object>¶
- class simstack.models.charts_artifact.ChartArtifactModel(*, parent_id: ObjectId | None = None, data: list[dict[str, ~typing.Any]]=<factory>, title: AGChartTitleConfig, series: list[AGLineSeriesConfig | AGBarSeriesConfig | AGRangeBarSeriesConfig | AGColumnSeriesConfig | AGAreaSeriesConfig | AGScatterSeriesConfig | AGHeatmapSeriesConfig | AGPieSeriesConfig | AGDonutSeriesConfig] = <factory>, axes: list[AGChartAxisConfig] = <factory>, legend: AGChartLegendConfig = AGChartLegendConfig(enabled=True, position='right', spacing=20.0, item={}), width: int = 800, height: int = 400, padding: dict[str, int] | None=None, background: dict[str, ~typing.Any] | None=None, frame: AGChartFrameConfig = AGChartFrameConfig(enabled=False, stroke='black', strokeWidth=1.0, cornerRadius=0.0, opacity=1.0), animation: dict[str, ~typing.Any] | None=None, tooltip: dict[str, ~typing.Any] | None=None, theme: str | None = 'ag-default', options: dict[str, ~typing.Any] | None=<factory>, id: ObjectId = <factory>)[source]¶
Bases:
ModelAG-Charts configuration model.
- animation: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- axes: list[AGChartAxisConfig] = <odmantic.field.FieldProxy object>¶
- background: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: list[dict[str, Any]] = <odmantic.field.FieldProxy object>¶
- frame: AGChartFrameConfig = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- height: int = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- legend: AGChartLegendConfig = <odmantic.field.FieldProxy object>¶
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- options: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- padding: dict[str, int] | None = <odmantic.field.FieldProxy object>¶
- parent_id: ObjectId | None = <odmantic.field.FieldProxy object>¶
- series: list[AGLineSeriesConfig | AGBarSeriesConfig | AGRangeBarSeriesConfig | AGColumnSeriesConfig | AGAreaSeriesConfig | AGScatterSeriesConfig | AGHeatmapSeriesConfig | AGPieSeriesConfig | AGDonutSeriesConfig] = <odmantic.field.FieldProxy object>¶
- theme: str | None = <odmantic.field.FieldProxy object>¶
- title: AGChartTitleConfig = <odmantic.field.FieldProxy object>¶
- tooltip: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- width: int = <odmantic.field.FieldProxy object>¶
- simstack.models.charts_artifact.create_multi_series_line_chart(data: List[Dict[str, Any]], x_key: str, y_keys: List[str], title: str | None = None, parent_id: ObjectId | None = None) ChartArtifactModel[source]¶
Create a line chart with multiple y-axis series.
- simstack.models.charts_artifact.create_simple_area_chart(data: List[Dict[str, Any]], x_key: str, y_key: str, title: str | None = None, parent_id: ObjectId | None = None) ChartArtifactModel[source]¶
Create a simple area chart.
- simstack.models.charts_artifact.create_simple_bar_chart(data: List[Dict[str, Any]], x_key: str, y_key: str, title: str | None = None, parent_id: ObjectId | None = None) ChartArtifactModel[source]¶
Create a simple bar chart.
- simstack.models.charts_artifact.create_simple_donut_chart(data: List[Dict[str, Any]], angle_key: str, label_key: str, title: str | None = None, legend_item_key: str | None = None, callout_label_key: str | None = None, sector_label_key: str | None = None, inner_radius_ratio: float = 0.6, parent_id: ObjectId | None = None) ChartArtifactModel[source]¶
Create a simple donut chart.
- simstack.models.charts_artifact.create_simple_heatmap_chart(data: List[Dict[str, Any]], x_key: str, y_key: str, color_key: str, title: str | None = None, parent_id: ObjectId | None = None, x_axis_type: Literal['category', 'number', 'time', 'log'] = 'category', y_axis_type: Literal['category', 'number', 'time', 'log'] = 'category') ChartArtifactModel[source]¶
Create a simple heatmap chart.
- simstack.models.charts_artifact.create_simple_line_chart(data: List[Dict[str, Any]], x_key: str, y_key: str, title: str | None = None, parent_id: ObjectId = None) ChartArtifactModel[source]¶
Create a simple line chart.
- simstack.models.charts_artifact.create_simple_pie_chart(data: List[Dict[str, Any]], angle_key: str, label_key: str, title: str | None = None, legend_item_key: str | None = None, callout_label_key: str | None = None, sector_label_key: str | None = None, parent_id: ObjectId | None = None) ChartArtifactModel[source]¶
Create a simple pie chart.
- simstack.models.charts_artifact.create_simple_range_bar_chart(data: List[Dict[str, Any]], x_key: str, y_low_key: str, y_high_key: str, title: str | None = None, parent_id: ObjectId | None = None, direction: Literal['horizontal', 'vertical'] | None = None) ChartArtifactModel[source]¶
Create a simple range-bar chart.
- simstack.models.charts_artifact.create_simple_scatter_chart(data: List[Dict[str, Any]], x_key: str, y_key: str, title: str | None = None, parent_id: ObjectId | None = None) ChartArtifactModel[source]¶
Create a simple scatter chart.
simstack.models.dataset module¶
- class simstack.models.dataset.DataSet(*, field_name: str = 'dataset', metadata: DataSetMetadata, sections: dict[str, ~simstack.models.dataset.DataSetSection]=<factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- property dataset_type: str¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- get(key: str, default: DataSetSection = None) DataSetSection[source]¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- items() ItemsView[str, DataSetSection][source]¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- metadata: DataSetMetadata = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- pop(key: str, default=None) DataSetSection[source]¶
- sections: dict[str, DataSetSection] = <odmantic.field.FieldProxy object>¶
- setdefault(key: str, default: DataSetSection = None) DataSetSection[source]¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- update(other: Dict[str, DataSetSection] | DataSet = None, **kwargs) None[source]¶
- values() ValuesView[DataSetSection][source]¶
- class simstack.models.dataset.DataSetSection(*, model_types: dict[str, str]=<factory>, data: dict[str, dict[str, ~odmantic.bson.ObjectId]]=<factory>, column_defs: list[dict[()]] = <factory>, table_entries: list[list[dict[()]]] = <factory>)[source]¶
Bases:
EmbeddedModelRepresents a section of a dataset containing dictionaries of models.
A DataSetSection is a list of dictionaries where for each key, the values are of the same model type.
- Variables:
model_types – Dictionary mapping keys to model class names.
data – Dictionary mapping names to dictionaries mapping keys to ObjectIds.
- add_row(item: Dict[str, Model | None], name: str | None = None) None[source]¶
Add a dictionary of models to this section.
- Parameters:
item – Dictionary of model instances to add.
name – Optional name for the item. If None, a UUID will be generated.
- Raises:
ValueError – If the model types don’t match the section’s expected types.
TypeError – If a non-None item value is not a Model instance.
- column_defs: list[dict[()]] = <odmantic.field.FieldProxy object>¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: dict[str, dict[str, ObjectId]] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- async load_to_cache(db: Database) None[source]¶
Load all items from the database into the cache assuming that data is already loaded.
- async make_column_defs()[source]¶
Generate ag-grid column definitions for all model types in this section.
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_types: dict[str, str] = <odmantic.field.FieldProxy object>¶
- table_entries: list[list[dict[()]]] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- update(other: Dict[str, Dict[str, Model | None]] | DataSetSection) None[source]¶
- class simstack.models.dataset.DataSetSelection(*, field_name: str = 'dataset_selection', dataset_id: ObjectId, dataset_selection_fields: list[DataSetSelectionField] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- dataset_id: ObjectId = <odmantic.field.FieldProxy object>¶
- dataset_selection_fields: list[DataSetSelectionField] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- get_selected_elements(section_name: str = None) List[Tuple[Model, ...]][source]¶
Retrieve all selected model groups from the dataset.
- Parameters:
section_name – Optional section name to filter results. If None, returns all sections.
- Returns:
List of tuples of model instances for all selected elements
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- class simstack.models.dataset.DataSetSelectionField(*, section_name: str = 'default', indices: list[int] = <factory>)[source]¶
Bases:
EmbeddedModel- indices: list[int] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- section_name: str = <odmantic.field.FieldProxy object>¶
simstack.models.dataset_metadata module¶
- class simstack.models.dataset_metadata.DataSetMetadata(*, field_name: str, data: dict[str, str | int | float | bool | ~odmantic.bson._datetime]=<factory>, is_validated: bool = False, structure: dict[str, dict[str, str]]=<factory>)[source]¶
Bases:
EmbeddedModel- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: dict[str, str | int | float | bool | _datetime] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- property initialized: bool¶
Check if the model has been fully constructed.
- is_type_compatible(key: str, value) bool[source]¶
Check if a value is type-compatible with existing key.
- is_validated: bool = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- structure: dict[str, dict[str, str]] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.dataset_metadata.DataSetMetadataTemplate(*, dataset_type: str, model_json: dict[str, ~typing.Any], structure: dict[str, dict[str, str]] = <factory>, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
Model- dataset_type: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_json: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- structure: dict[str, dict[str, str]] = <odmantic.field.FieldProxy object>¶
simstack.models.datasettuple module¶
- class simstack.models.datasettuple.DataSetTuple(*, field_name: str = 'dataset', metadata: DataSetMetadata, sections: dict[str, ~simstack.models.datasettuple.DataSetTupleSection]=<factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async clone(new_field_name: str = None, exclude_sections: List[str] = None) DataSetTuple[source]¶
Clone the dataset with optionally a new field name and excluding specified sections.
- Parameters:
new_field_name – Optional new field name for the cloned dataset. If None, uses original field_name.
exclude_sections – Optional list of section names to exclude from the clone. If None, all sections are cloned.
- Returns:
A new DataSet instance that is a clone of this dataset
- collect_structure() Dict[str, Dict[str, str]][source]¶
Returns a dictionary where keys are section names and values are dictionaries mapping string indices to model types at those indices.
- Returns:
Dictionary mapping section names to their model type structures
- Return type:
Dict[str, Dict[str, str]]
- property dataset_type: str¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- get(key: str, default: DataSetTupleSection = None) DataSetTupleSection[source]¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- items() ItemsView[str, DataSetTupleSection][source]¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- metadata: DataSetMetadata = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- pop(key: str, default=None) DataSetTupleSection[source]¶
- popitem() Tuple[str, DataSetTupleSection][source]¶
- sections: dict[str, DataSetTupleSection] = <odmantic.field.FieldProxy object>¶
- setdefault(key: str, default: DataSetTupleSection = None) DataSetTupleSection[source]¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- update(other: Dict[str, DataSetTupleSection] | DataSetTuple = None, **kwargs) None[source]¶
- values() ValuesView[DataSetTupleSection][source]¶
- class simstack.models.datasettuple.DataSetTupleSection(*, model_types: list[str] = <factory>, data: list[list[ObjectId]] = <factory>, column_defs: list[dict[()]] = <factory>, table_entries: list[list[dict[()]]] = <factory>)[source]¶
Bases:
EmbeddedModelRepresents a section of a dataset containing tuples of models.
A DataSetSection is a list of tuples where all tuples contain the same types of models. For example, if one tuple contains (ModelA, ModelB), then all tuples in this section must contain (ModelA, ModelB) instances.
- Variables:
model_types – List of model class names that define the structure of each tuple.
data – List of tuples, where each tuple contains model IDs corresponding to model_types.
- async add_model_group(models: Model | Tuple[Model, ...]) None[source]¶
Add a tuple of models to this section.
- Parameters:
models – Tuple of model instances to add
- Raises:
ValueError – If the model types don’t match the section’s expected types
- async append(models: Tuple[Model, ...]) None[source]¶
Append a tuple of models to the section.
- Parameters:
models – Tuple of model instances to append
- column_defs: list[dict[()]] = <odmantic.field.FieldProxy object>¶
- count(models: Tuple[Model, ...]) int[source]¶
Return the number of occurrences of the specified tuple of models.
- Parameters:
models – Tuple of model instances to count
- Returns:
Number of occurrences
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: list[list[ObjectId]] = <odmantic.field.FieldProxy object>¶
- extend(models_list: List[Tuple[Model, ...]]) None[source]¶
Extend the section with multiple tuples of models.
- Parameters:
models_list – List of tuples of model instances to extend with
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- async get_all_model_groups() List[Tuple[Model, ...]][source]¶
Retrieve all tuples in this section.
- Returns:
List of tuples of model instances
- async get_model_group(index: int) Tuple[Model, ...][source]¶
Retrieve a tuple of models at the specified index.
- Parameters:
index – Index of the tuple to retrieve
- Returns:
Tuple of model instances
- async index(models: Tuple[Model, ...], start: int = 0, stop: int = None) int[source]¶
Return the index of the first occurrence of the specified tuple of models.
- Parameters:
models – Tuple of model instances to find
start – Start index for search
stop – Stop index for search
- Returns:
Index of the tuple
- Raises:
ValueError – If the tuple is not found
- async insert(index: int, models: Tuple[Model, ...]) None[source]¶
Insert a tuple of models at the specified index.
- Parameters:
index – Index to insert at
models – Tuple of model instances to insert
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- async make_column_defs()[source]¶
Generate ag-grid column definitions for all model types in this section.
- Returns:
List of column definitions for ag-grid
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_types: list[str] = <odmantic.field.FieldProxy object>¶
- async pop(index: int = -1) Tuple[Model, ...][source]¶
Remove and return a model group at the specified index (default last).
- Parameters:
index – Index to pop (default -1 for last)
- Returns:
Tuple of model instances that was removed
- async remove(models: Tuple[Model, ...]) None[source]¶
Remove the first occurrence of the specified tuple of models.
- Parameters:
models – Tuple of model instances to remove
- Raises:
ValueError – If the tuple is not found
- table_entries: list[list[dict[()]]] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.datasettuple.DataSetTupleSelection(*, field_name: str = 'dataset_selection', dataset_id: ObjectId, dataset_selection_fields: list[DataSetTupleSelectionField] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- dataset_id: ObjectId = <odmantic.field.FieldProxy object>¶
- dataset_selection_fields: list[DataSetTupleSelectionField] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- async get_selected_elements(section_name: str = None) List[Tuple[Model, ...]][source]¶
Retrieve all selected model groups from the dataset.
- Parameters:
section_name – Optional section name to filter results. If None, returns all sections.
- Returns:
List of tuples of model instances for all selected elements
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- class simstack.models.datasettuple.DataSetTupleSelectionField(*, section_name: str = 'default', indices: list[int] = <factory>)[source]¶
Bases:
EmbeddedModel- indices: list[int] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- section_name: str = <odmantic.field.FieldProxy object>¶
simstack.models.file_instance module¶
- class simstack.models.file_instance.FileInstance(*, id: str | None = None, path: str, resource: Resource, created_at: _datetime, runner_id: str | None = None, location_type: str = 'local_path', size_bytes: int | None = None, checksum_sha256: str | None = None, last_accessed_at: _datetime | None = None, expires_at: _datetime | None = None, is_authoritative: bool = True, is_cached: bool = False, status: str = 'available')[source]¶
Bases:
EmbeddedModelRepresents an embedded model for a file instance.
The FileInstance class is used to encapsulate details about a file, including its path, associated resource, and creation timestamp. It provides a class method for initializing a FileInstance object from a local file path, ensuring proper handling of file-related operations.
- path¶
Path to the file relative to the host work directory.
- Type:
str
- created_at¶
Timestamp indicating when the file instance was created.
- Type:
datetime
- checksum_sha256: str | None = <odmantic.field.FieldProxy object>¶
- created_at: _datetime = <odmantic.field.FieldProxy object>¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- expires_at: _datetime | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_local_file(path: Path | str, file_stack_id: ObjectId, make_copy: bool = True, tasks_id: str = '') FileInstance[source]¶
Creates a FileInstance object from a local file path.
This class method is responsible for initializing a FileInstance based on a local file’s path. It supports options to hash the file, make a user-specific copy, and tracks additional metadata. The method handles local file operations such as copying files to a secure directory when necessary and organizes resources under a configurable working directory.
- Parameters:
file_stack_id – the id of the filestack where the file is in
path – The file path to the local file. Can be either a string or Path.
make_copy – Indicates whether a secure local copy of the file should be made within the application’s working directory. Defaults to True.
- Returns:
A FileInstance object initialized with file details.
- Return type:
- Raises:
ValueError – If there are issues during the creation of the FileInstance from the specified local file.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: str | None = <odmantic.field.FieldProxy object>¶
- is_authoritative: bool = <odmantic.field.FieldProxy object>¶
- is_cached: bool = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- last_accessed_at: _datetime | None = <odmantic.field.FieldProxy object>¶
- location_type: str = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- path: str = <odmantic.field.FieldProxy object>¶
- runner_id: str | None = <odmantic.field.FieldProxy object>¶
- size_bytes: int | None = <odmantic.field.FieldProxy object>¶
- status: str = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.file_list module¶
- class simstack.models.file_list.FileList(*, elements: list[ObjectId] = <factory>)[source]¶
Bases:
EmbeddedModel,ObjectListMixin[FileStack]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.file_list.FileListIO(*, file_list: FileList = <factory>, task_status: str | None = None, error: str | None = None, message: str | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- error: str | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- message: str | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- task_status: str | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.file_list.FileListModel(*, elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[FileStack]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.files module¶
- class simstack.models.files.FileGetterArgs(*, file_stack: FileStack, local_resource: Resource, local_dir: Path, id: ObjectId = <factory>)[source]¶
Bases:
Model- id: ObjectId = <odmantic.field.FieldProxy object>¶
- local_dir: Path = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class simstack.models.files.FileStack(*, name: str | None = None, size: int | None = None, is_hashable: bool = False, hash: str | None = None, in_memory: bool = False, content: bytes | None = None, locations: list[FileInstance] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- append(file_instance: FileInstance) None[source]¶
Appends a FileInstance to the file stack.
- Parameters:
file_instance (FileInstance) – The FileInstance to append.
- content: bytes | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_local_file(path: Path | str, is_hashable: bool = True, in_memory: bool = True, secure_source: bool = False, task_id: str = '') FileStack[source]¶
Creates a FileStack object from a local file path.
- Parameters:
task_id (str) – task_id of the task that created the file stack, used for logging and tracking
secure_source (bool) – specifies if the source is secure (already in a directory generated within Simstack II)
path (Union[Path, str]) – The path to the local file. Can be provided as a string or Path object.
is_hashable (bool) – A flag indicating whether the file hash needs to be calculated.
in_memory (bool) – Whether to store the compressed file content in memory. Defaults to True.
- Returns:
A FileStack object containing FileInstances for the file.
- Return type:
- classmethod from_model(model: Model, **kwargs) Model¶
- get(local_dir: Path | None = None) Path[source]¶
Copies the file stack to a local directory. This is the version to be used in applications
- Parameters:
local_dir (Path) – The local directory to copy the file stack to.
- get_raw(local_resource: Resource, local_dir: Path | None = None) Path[source]¶
Copies the file stack to a local directory, assumes no context.
- Parameters:
local_resource – the local resource to copy the file stack to. Defaults to the current resource.
local_dir (Path) – The local directory to copy the file stack to.
- hash: str | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- in_memory: bool = <odmantic.field.FieldProxy object>¶
- is_hashable: bool = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- locations: list[FileInstance] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str | None = <odmantic.field.FieldProxy object>¶
- size: int | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.fire_and_forget_result module¶
- class simstack.models.fire_and_forget_result.FireAndForgetResult(*, call_path: str, models: dict[str, ~typing.Any], success: bool, next_step: bool = False, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
ModelModel representing the result of a fire-and-forget task.
- call_path¶
The full call path of the node.
- Type:
str
- models¶
A dictionary mapping argument/result names to their values.
- Type:
dict[str, Any]
- success¶
Whether the task was successful.
- Type:
bool
- next_step¶
Whether this result triggers a next step.
- Type:
bool
- call_path: str = <odmantic.field.FieldProxy object>¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- models: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- next_step: bool = <odmantic.field.FieldProxy object>¶
- success: bool = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.images2d module¶
- class simstack.models.images2d.Image2DArtifactModel(*, parent_id: ~odmantic.bson.ObjectId | None = None, name: str, description: str | None = None, format: ~typing.Literal['png', 'jpg', 'jpeg', 'svg', 'gif', 'bmp', 'webp'], data: bytes, width: int | None = None, height: int | None = None, metadata: dict[str, ~typing.Any] = <factory>, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
ModelModel for storing 2D image artifacts in MongoDB.
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: bytes = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- format: Literal['png', 'jpg', 'jpeg', 'svg', 'gif', 'bmp', 'webp'] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- height: int | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- metadata: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- parent_id: ObjectId | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- width: int | None = <odmantic.field.FieldProxy object>¶
- simstack.models.images2d.create_image_artifact(name: str, data: bytes, format: str, description: str | None = None, parent_id: ObjectId | None = None, width: int | None = None, height: int | None = None, metadata: Dict[str, Any] | None = None) Image2DArtifactModel[source]¶
Create an Image2DArtifactModel instance.
- simstack.models.images2d.create_image_artifact_from_file(path: str, name: str | None = None, description: str | None = None, parent_id: ObjectId | None = None) Image2DArtifactModel[source]¶
Create an Image2DArtifactModel instance from a file path.
simstack.models.log_entry_model module¶
- class simstack.models.log_entry_model.LogEntry(*, timestamp: _datetime = <factory>, level: LogLevel, logger_name: str, message: str, module: str, function: str, line: int, task_id: str | None = None, resource: str | None = None, thread_name: str | None = None, process_name: str | None = None, exception_type: str | None = None, exception_message: str | None = None, exception_traceback: str | None = None, parameters: Parameters | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Model- exception_message: str | None = <odmantic.field.FieldProxy object>¶
- exception_traceback: str | None = <odmantic.field.FieldProxy object>¶
- exception_type: str | None = <odmantic.field.FieldProxy object>¶
- function: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- line: int = <odmantic.field.FieldProxy object>¶
- logger_name: str = <odmantic.field.FieldProxy object>¶
- message: str = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'logs', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- module: str = <odmantic.field.FieldProxy object>¶
- parameters: Parameters | None = <odmantic.field.FieldProxy object>¶
- process_name: str | None = <odmantic.field.FieldProxy object>¶
- resource: str | None = <odmantic.field.FieldProxy object>¶
- task_id: str | None = <odmantic.field.FieldProxy object>¶
- thread_name: str | None = <odmantic.field.FieldProxy object>¶
- timestamp: _datetime = <odmantic.field.FieldProxy object>¶
simstack.models.models module¶
- class simstack.models.models.DataMapping(*, name: str, mapping: str, description: str | None = '', version: str | None = None)[source]¶
Bases:
EmbeddedModel- description: str | None = <odmantic.field.FieldProxy object>¶
- mapping: str = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.models.ModelMapping(*, name: str, mapping: str, version: str | None = None, collection_name: str, json_schema: str | None = None, ui_schema: str | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Modelname: shorthand - must be unique mapping: full name - path relative to project root in module.module.class/function format
- collection_name: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- json_schema: str | None = <odmantic.field.FieldProxy object>¶
- mapping: str = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- ui_schema: str | None = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.models.NodeModel(*, name: str, function_mapping: str, version: str | None = None, input_mappings: list[~simstack.models.models.DataMapping], result_mappings: list[~simstack.models.models.DataMapping] = <factory>, called_nodes: list[str] = <factory>, description: str | None = '', favorite: bool = False, default_parameters: ~simstack.models.parameters.Parameters, pickle_function: ~simstack.models.pickle_models.FunctionPickle | None = None, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
Model- called_nodes: list[str] = <odmantic.field.FieldProxy object>¶
- default_parameters: Parameters = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- favorite: bool = <odmantic.field.FieldProxy object>¶
- function_mapping: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- input_mappings: list[DataMapping] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'node_model', 'extra': None, 'indexes': None, 'json_encoders': {<class 'bytes'>: <function NodeModel.<lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- pickle_function: FunctionPickle | None = <odmantic.field.FieldProxy object>¶
- result_mappings: list[DataMapping] = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
simstack.models.named_data_reference module¶
- class simstack.models.named_data_reference.NamedDataReference(*, variable_name: str, variable_mapping: str, reference: ObjectId)[source]¶
Bases:
EmbeddedModel- classmethod from_variable(variable: Model, variable_name: str | None = None, task_id: str | None = None)[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- reference: ObjectId = <odmantic.field.FieldProxy object>¶
- variable_mapping: str = <odmantic.field.FieldProxy object>¶
- variable_name: str = <odmantic.field.FieldProxy object>¶
simstack.models.node_registry module¶
- class simstack.models.node_registry.NodeRegistry(*, name: str, status: TaskStatus, custom_name: str | None = None, version: str | None = None, project: ObjectId | None = None, category: str | None = None, description: str | None = None, call_path: str | None = None, assignment_rule_id: str | None = None, assignment_rule_name: str | None = None, assignment_pattern: str | None = None, error: str | None = None, message: str | None = None, input_references: list[NamedDataReference] = <factory>, results_references: list[NamedDataReference] = <factory>, info_files: FileList = <factory>, parent_ids: list[ObjectId] = <factory>, artifact_ids: list[ObjectId] = <factory>, created_at: _datetime = <factory>, started_at: _datetime | None = None, completed_at: _datetime | None = None, job_id: str | None = None, function_hash: str, arg_hash: str, func_mapping: str, is_async: bool = False, parameters: Parameters = <odmantic.reference.ODMReferenceInfo object>, id: ObjectId = <factory>)[source]¶
Bases:
ModelRepresents a registry for nodes with associated metadata, configurations, and status information. It allows tracking the state and attributes of a workflow node, including its execution parameters, process status, and relationship to other nodes.
This class is designed for managing workflow instances and their lifecycle, with capabilities to monitor execution states, inputs, outputs, and associated timestamps.
- Variables:
name – The name of the node.
custom_name – An optional custom name for the node.
status – TheTaskStatus of the node in string format.
category – An optional category classification for the node.
description – An optional description providing details about the node.
input_references – List of references to input data.
results_references – List of references to result data.
parent_ids – A list of identifiers representing parent nodes associated with this node.
created_at – The timestamp when the node was created.
started_at – An optional timestamp indicating when the execution of the node started.
completed_at – An optional timestamp indicating when the execution of the node was completed.
function_hash – A hash value representing the unique function executed by this node.
arg_hash – A hash value representing the unique arguments passed to the function of this node.
func_mapping – A mapping identifier associated with the function executed by this node.
is_async – A boolean value indicating whether the node execution is asynchronous.
parameters – Parameters associated with the node execution.
call_path – An optional path indicating where the function is called from by concatenating the name of all nodes in the call stack.
- arg_hash: str = <odmantic.field.FieldProxy object>¶
- artifact_ids: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- assignment_pattern: str | None = <odmantic.field.FieldProxy object>¶
- assignment_rule_id: str | None = <odmantic.field.FieldProxy object>¶
- assignment_rule_name: str | None = <odmantic.field.FieldProxy object>¶
- call_path: str | None = <odmantic.field.FieldProxy object>¶
- category: str | None = <odmantic.field.FieldProxy object>¶
- completed_at: _datetime | None = <odmantic.field.FieldProxy object>¶
- created_at: _datetime = <odmantic.field.FieldProxy object>¶
- custom_name: str | None = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- error: str | None = <odmantic.field.FieldProxy object>¶
- func_mapping: str = <odmantic.field.FieldProxy object>¶
- function_hash: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- input_references: list[NamedDataReference] = <odmantic.field.FieldProxy object>¶
- is_async: bool = <odmantic.field.FieldProxy object>¶
- job_id: str | None = <odmantic.field.FieldProxy object>¶
- message: str | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- parameters: Parameters = <odmantic.field.FieldProxy object>¶
- parent_ids: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- project: ObjectId | None = <odmantic.field.FieldProxy object>¶
- results_references: list[NamedDataReference] = <odmantic.field.FieldProxy object>¶
- started_at: _datetime | None = <odmantic.field.FieldProxy object>¶
- status: TaskStatus = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
- async simstack.models.node_registry.find_child_nodes(task_id: str) List[NodeRegistry][source]¶
simstack.models.pandas_model module¶
- class simstack.models.pandas_model.PandasModel(*, field_name: str = 'pandas_model', content_: bytes = b'', file_stack: FileStack | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Model- content_: bytes = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': [('field_name', {'unique': True})], 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property table¶
- to_react_data(orient='records')[source]¶
Convert the DataFrame to a Python object suitable for conversion to JSON. This can be used in API responses.
Returns: - List/Dict: Python object ready for json.dumps()
- to_react_json(orient='records')[source]¶
Convert the DataFrame to a JSON string suitable for React visualization libraries.
Parameters: - orient: Determines the JSON string layout:
‘records’ - list like [{column -> value}, … , {column -> value}] (default) ‘columns’ - {column -> [values, …]} ‘index’ - {column -> value}} ‘split’ - {index -> [index], columns -> [columns], data -> [values]} ‘table’ - {‘schema’: {schema}, ‘data’: {data}}
Returns: - String: JSON formatted string ready for React
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
simstack.models.parameters module¶
- class simstack.models.parameters.Parameters(*, force_rerun: bool = False, resource: Resource = <factory>, queue: str = 'default', recompute_artifacts: bool | None = False, docker_image: str | None = None, other_value: str = 'other', test_dict: dict[str, ~typing.Any]=<factory>, slurm_parameters: SlurmParameters = None)[source]¶
Bases:
EmbeddedModel- docker_image: str | None = <odmantic.field.FieldProxy object>¶
- force_rerun: bool = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': {'description': 'Parameters for running a simulation', 'examples': [{'queue': 'default', 'resource': 'self', 'slurm_parameters': {'nodes': 2}}], 'title': 'Parameters'}, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- other_value: str = <odmantic.field.FieldProxy object>¶
- queue: str = <odmantic.field.FieldProxy object>¶
- recompute_artifacts: bool | None = <odmantic.field.FieldProxy object>¶
- slurm_parameters: SlurmParameters = <odmantic.field.FieldProxy object>¶
- test_dict: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- classmethod validate_resource(v)[source]¶
Validate and convert resource input to a Resource object.
Accepts string, Resource objects, and dictionary representations. If a string is provided, converts it to a Resource object. If a dictionary is provided (e.g., during deserialization), extracts the value and creates a Resource object.
- Parameters:
v – The value to validate (str, Resource, or dict)
- Returns:
The validated Resource object
- Return type:
- class simstack.models.parameters.Queue(*values)[source]¶
Bases:
str,Enum- DEFAULT = 'default'¶
- DOCKER = 'docker'¶
- SLURM_DOCKER = 'slurm-docker'¶
- SLURM_QUEUE = 'slurm-queue'¶
- class simstack.models.parameters.Resource(*, value: str)[source]¶
Bases:
EmbeddedModelResource whose value is validated against the allowed resources only when the value is read, not when it is set or constructed.
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- value: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.parameters.SlurmParameters(*, nodes: Annotated[int | None, ~annotated_types.Ge(ge=1)] = 1, tasks: Annotated[int | None, ~annotated_types.Ge(ge=1)] = 1, tasks_per_node: Annotated[int | None, ~annotated_types.Ge(ge=1)] = 1, cpus_per_task: Annotated[int | None, ~annotated_types.Ge(ge=1)] = 1, mem: str | None = '1G', mem_per_cpu: str | None = None, time: str | None = '1:00:00', begin: str | None = None, partition: str | None = None, qos: str | None = None, job_name: str | None = 'simstack', output: str | None = None, error: str | None = None, mail_type: str | None = None, mail_user: str | None = None, gres: str | None = None, account: str | None = None, priority: int | None = None, reservation: str | None = None, constraint: str | None = None, exclusive: bool | None = None, nice: int | None = None, dependency: str | None = None, array: str | None = None, startup_commands: list[str] = <factory>, chdir: str | None = None, export: str | None = None, signal: str | None = None, requeue: bool | None = None, no_requeue: bool | None = None)[source]¶
Bases:
EmbeddedModel- account: str | None = <odmantic.field.FieldProxy object>¶
- array: str | None = <odmantic.field.FieldProxy object>¶
- begin: str | None = <odmantic.field.FieldProxy object>¶
- chdir: str | None = <odmantic.field.FieldProxy object>¶
- constraint: str | None = <odmantic.field.FieldProxy object>¶
- cpus_per_task: int | None = <odmantic.field.FieldProxy object>¶
- dependency: str | None = <odmantic.field.FieldProxy object>¶
- error: str | None = <odmantic.field.FieldProxy object>¶
- exclusive: bool | None = <odmantic.field.FieldProxy object>¶
- export: str | None = <odmantic.field.FieldProxy object>¶
- gres: str | None = <odmantic.field.FieldProxy object>¶
- job_name: str | None = <odmantic.field.FieldProxy object>¶
- mail_type: str | None = <odmantic.field.FieldProxy object>¶
- mail_user: str | None = <odmantic.field.FieldProxy object>¶
- mem: str | None = <odmantic.field.FieldProxy object>¶
- mem_per_cpu: str | None = <odmantic.field.FieldProxy object>¶
- model_config: ClassVar[Dict[str, Any]] = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': {'description': 'Comprehensive parameters for Slurm job submission', 'examples': [{'cpus_per_task': 4, 'error': 'job_%j.err', 'gres': 'gpu:2', 'job_name': 'my_simulation', 'mail_type': 'END,FAIL', 'mail_user': 'user@institution.edu', 'mem': '64G', 'nodes': 2, 'ntasks_per_node': 8, 'output': 'job_%j.out', 'partition': 'compute', 'time': '12:00:00'}], 'title': 'SlurmParameters'}, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- nice: int | None = <odmantic.field.FieldProxy object>¶
- no_requeue: bool | None = <odmantic.field.FieldProxy object>¶
- nodes: int | None = <odmantic.field.FieldProxy object>¶
- output: str | None = <odmantic.field.FieldProxy object>¶
- partition: str | None = <odmantic.field.FieldProxy object>¶
- priority: int | None = <odmantic.field.FieldProxy object>¶
- qos: str | None = <odmantic.field.FieldProxy object>¶
- requeue: bool | None = <odmantic.field.FieldProxy object>¶
- reservation: str | None = <odmantic.field.FieldProxy object>¶
- signal: str | None = <odmantic.field.FieldProxy object>¶
- startup_commands: list[str] = <odmantic.field.FieldProxy object>¶
- tasks: int | None = <odmantic.field.FieldProxy object>¶
- tasks_per_node: int | None = <odmantic.field.FieldProxy object>¶
- time: str | None = <odmantic.field.FieldProxy object>¶
simstack.models.pickle_models module¶
- class simstack.models.pickle_models.ClassPickle(*, name: str, module_path: str, pickle_data: bytes | None = None, id: ObjectId = <factory>)[source]¶
Bases:
BytesB64Mixin,ModelPersist an arbitrary Python class in MongoDB.
Fields¶
name – class __name__ (for reference / debugging) module_path – original module path (dotted) pickle_data – base64-encoded pickled bytes of the class
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bytes'>: <function BytesB64Mixin.<lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- module_path: str = <odmantic.field.FieldProxy object>¶
- name: str = <odmantic.field.FieldProxy object>¶
- pickle_data: bytes | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.pickle_models.FunctionPickle(*, name: str, module_path: str, pickle_data: bytes | None = None, id: ObjectId = <factory>)[source]¶
Bases:
BytesB64Mixin,ModelPersist an arbitrary Python function in MongoDB.
Fields¶
name – function __name__ module_path – original module path pickle_data – base64 pickled bytes of the function
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_encoders': {<class 'bytes'>: <function BytesB64Mixin.<lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- module_path: str = <odmantic.field.FieldProxy object>¶
- name: str = <odmantic.field.FieldProxy object>¶
- pickle_data: bytes | None = <odmantic.field.FieldProxy object>¶
simstack.models.project module¶
- class simstack.models.project.Project(*, field_name: str, description: str | None = None, tag_ids: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- description: str | None = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'projects', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- tag_ids: list[ObjectId] = <odmantic.field.FieldProxy object>¶
simstack.models.resource_assignment module¶
- class simstack.models.resource_assignment.ResourceAssignmentRule(*, name: str, regex_pattern: str, priority: int = 0, enabled: bool = True, resource_str: str | None = None, queue: str | None = None, slurm_parameters_patch: dict[str, ~typing.Any]=<factory>, description: str | None = '', id: ObjectId = <factory>)[source]¶
Bases:
Model- description: str | None = <odmantic.field.FieldProxy object>¶
- enabled: bool = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'resource_assignment_rule', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- priority: int = <odmantic.field.FieldProxy object>¶
- queue: str | None = <odmantic.field.FieldProxy object>¶
- regex_pattern: str = <odmantic.field.FieldProxy object>¶
- resource_str: str | None = <odmantic.field.FieldProxy object>¶
- slurm_parameters_patch: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- class simstack.models.resource_assignment.SlurmParametersPatch(*, nodes: Annotated[int | None, Ge(ge=1)] = None, tasks: Annotated[int | None, Ge(ge=1)] = None, tasks_per_node: Annotated[int | None, Ge(ge=1)] = None, cpus_per_task: Annotated[int | None, Ge(ge=1)] = None, mem: str | None = None, mem_per_cpu: str | None = None, time: str | None = None, begin: str | None = None, partition: str | None = None, qos: str | None = None, job_name: str | None = None, output: str | None = None, error: str | None = None, mail_type: str | None = None, mail_user: str | None = None, gres: str | None = None, account: str | None = None, priority: int | None = None, reservation: str | None = None, constraint: str | None = None, exclusive: bool | None = None, nice: int | None = None, dependency: str | None = None, array: str | None = None, startup_commands: list[str] | None = None, chdir: str | None = None, export: str | None = None, signal: str | None = None, requeue: bool | None = None, no_requeue: bool | None = None)[source]¶
Bases:
EmbeddedModel- account: str | None = <odmantic.field.FieldProxy object>¶
- array: str | None = <odmantic.field.FieldProxy object>¶
- begin: str | None = <odmantic.field.FieldProxy object>¶
- chdir: str | None = <odmantic.field.FieldProxy object>¶
- constraint: str | None = <odmantic.field.FieldProxy object>¶
- cpus_per_task: int | None = <odmantic.field.FieldProxy object>¶
- dependency: str | None = <odmantic.field.FieldProxy object>¶
- error: str | None = <odmantic.field.FieldProxy object>¶
- exclusive: bool | None = <odmantic.field.FieldProxy object>¶
- export: str | None = <odmantic.field.FieldProxy object>¶
- gres: str | None = <odmantic.field.FieldProxy object>¶
- job_name: str | None = <odmantic.field.FieldProxy object>¶
- mail_type: str | None = <odmantic.field.FieldProxy object>¶
- mail_user: str | None = <odmantic.field.FieldProxy object>¶
- mem: str | None = <odmantic.field.FieldProxy object>¶
- mem_per_cpu: str | None = <odmantic.field.FieldProxy object>¶
- model_config: ClassVar[Dict[str, Any]] = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- nice: int | None = <odmantic.field.FieldProxy object>¶
- no_requeue: bool | None = <odmantic.field.FieldProxy object>¶
- nodes: int | None = <odmantic.field.FieldProxy object>¶
- output: str | None = <odmantic.field.FieldProxy object>¶
- partition: str | None = <odmantic.field.FieldProxy object>¶
- priority: int | None = <odmantic.field.FieldProxy object>¶
- qos: str | None = <odmantic.field.FieldProxy object>¶
- requeue: bool | None = <odmantic.field.FieldProxy object>¶
- reservation: str | None = <odmantic.field.FieldProxy object>¶
- signal: str | None = <odmantic.field.FieldProxy object>¶
- startup_commands: list[str] | None = <odmantic.field.FieldProxy object>¶
- tasks: int | None = <odmantic.field.FieldProxy object>¶
- tasks_per_node: int | None = <odmantic.field.FieldProxy object>¶
- time: str | None = <odmantic.field.FieldProxy object>¶
simstack.models.resource_definition module¶
- class simstack.models.resource_definition.GitRepo(*, url: str, branch: str | None, is_submodule: bool = False, id: ObjectId = <factory>)[source]¶
Bases:
ModelRepresents a Git repository with relevant attributes such as its URL, branch, and whether it is a submodule. Ensures that the URL provided is valid.
This class is used to model information about a Git repository, including its URL, the branch being used, and whether it is included as a submodule within another repository. It provides validation for the URL to ensure that it is in the correct format.
In the user database there is a list of Git repositories for the user
- Variables:
url – The URL of the Git repository.
branch – The branch of the Git repository. Optional.
is_submodule – Indicates whether the repository is a submodule. Defaults to False.
- branch: str | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- is_submodule: bool = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- url: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.resource_definition.ResourceDefinition(*, resource_str: str, workdir: str, hostname: str, python_paths: list[str] = <factory>, environment_start: str | None = None, ssh_key: str | None = None, routes: list[str] | None = [], queue: str = 'default', is_default: bool = False, git_branch: str = 'main', id: ObjectId = <factory>)[source]¶
Bases:
Model- environment_start: str | None = <odmantic.field.FieldProxy object>¶
- git_branch: str = <odmantic.field.FieldProxy object>¶
- hostname: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- is_default: bool = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- python_paths: list[str] = <odmantic.field.FieldProxy object>¶
- queue: str = <odmantic.field.FieldProxy object>¶
- resource_str: str = <odmantic.field.FieldProxy object>¶
- routes: list[str] | None = <odmantic.field.FieldProxy object>¶
- ssh_key: str | None = <odmantic.field.FieldProxy object>¶
- workdir: str = <odmantic.field.FieldProxy object>¶
simstack.models.runner_model module¶
- class simstack.models.runner_model.RunnerEvent(*, timestamp: _datetime = <factory>, event: RunnerEventEnum, resource: Resource, runner_type: RunnerType, hostname: str | None = None, user: str | None = None, pid: int | None = None, node_id: ObjectId | None = None, message: str | None = None, git_status: list[str] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- event: RunnerEventEnum = <odmantic.field.FieldProxy object>¶
- git_status: list[str] = <odmantic.field.FieldProxy object>¶
- hostname: str | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- message: str | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': True, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- node_id: ObjectId | None = <odmantic.field.FieldProxy object>¶
- pid: int | None = <odmantic.field.FieldProxy object>¶
- runner_type: RunnerType = <odmantic.field.FieldProxy object>¶
- timestamp: _datetime = <odmantic.field.FieldProxy object>¶
- user: str | None = <odmantic.field.FieldProxy object>¶
simstack.models.simple_table module¶
- class simstack.models.simple_table.SimpleTable(*, name: str = 'SimpleTable', heading: list[str] = <factory>, row: list[dict[str, ~typing.Any]]=<factory>, type: list[SimpleTableColumnType] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
ModelA simple table model to display tabular data using ag-grid
- add_column(column_name: str, column_type: SimpleTableColumnType | str) None[source]¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- heading: list[str] = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- row: list[dict[str, Any]] = <odmantic.field.FieldProxy object>¶
- type: list[SimpleTableColumnType] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- class simstack.models.simple_table.SimpleTableColumnType(*values)[source]¶
Bases:
str,Enum- NUMBER = 'number'¶
- STRING = 'string'¶
- classmethod from_value(value: SimpleTableColumnType | str) SimpleTableColumnType[source]¶
simstack.models.simstack_model module¶
simstack.models.slurm_info module¶
- class simstack.models.slurm_info.SlurmInfo(*, node_registry: ~odmantic.bson.ObjectId, updated: ~odmantic.bson._datetime, resource: ~simstack.models.parameters.Resource, job_id: str, name: str, user: str, code: str, time: str, nodes: list[str], id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
Model- code: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- job_id: str = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- node_registry: ObjectId = <odmantic.field.FieldProxy object>¶
- nodes: list[str] = <odmantic.field.FieldProxy object>¶
- time: str = <odmantic.field.FieldProxy object>¶
- updated: _datetime = <odmantic.field.FieldProxy object>¶
- user: str = <odmantic.field.FieldProxy object>¶
simstack.models.table_artifact module¶
- class simstack.models.table_artifact.AGGridColumnDef(*, field: str, headerName: str, width: int | None = None, minWidth: int | None = None, maxWidth: int | None = None, flex: int | None = None, hide: bool | None = None, sortable: bool | None = None, resizable: bool | None = None, editable: bool | None = None)[source]¶
Bases:
EmbeddedModelAG-Grid column definition with support for nested tables.
- editable: bool | None = <odmantic.field.FieldProxy object>¶
- field: str = <odmantic.field.FieldProxy object>¶
- flex: int | None = <odmantic.field.FieldProxy object>¶
- headerName: str = <odmantic.field.FieldProxy object>¶
- hide: bool | None = <odmantic.field.FieldProxy object>¶
- maxWidth: int | None = <odmantic.field.FieldProxy object>¶
- minWidth: int | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- resizable: bool | None = <odmantic.field.FieldProxy object>¶
- sortable: bool | None = <odmantic.field.FieldProxy object>¶
- width: int | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.table_artifact.TableArtifactModel(*, parent_id: ObjectId = None, columns_defs: list[AGGridColumnDef] = <factory>, row_data: list[dict[str, ~typing.Any]]=<factory>, master_detail: bool | None = False, detail_cell_renderer: str | None = None, detail_cell_renderer_params: dict[str, ~typing.Any] | None=None, id: ObjectId = <factory>)[source]¶
Bases:
Model- columns_defs: list[AGGridColumnDef] = <odmantic.field.FieldProxy object>¶
- detail_cell_renderer: str | None = <odmantic.field.FieldProxy object>¶
- detail_cell_renderer_params: dict[str, Any] | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- master_detail: bool | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- parent_id: ObjectId = <odmantic.field.FieldProxy object>¶
- row_data: list[dict[str, Any]] = <odmantic.field.FieldProxy object>¶
simstack.models.tag module¶
- class simstack.models.tag.Tag(*, name: str, description: str | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Model- description: str | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'tags', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
simstack.models.unused_test_file module¶
Module contents¶
- class simstack.models.ArrayList(*, elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[ArrayStorage]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.ArtifactMapping(*, name: str = 'artifact', regex_pattern: str = '', function_mapping: str = '', function_code: str = '', pickle_function: FunctionPickle | None = None, id: ObjectId = <factory>)¶
Bases:
ModelArtifactsMapper is a mapping between the artifact and a node registry-path. The workflow executor passes a path of the type
node1.node2.node4. … .nodeN
where node is the function name of the node
Regex can maps this to the target path of the ArtifactsMapping, e.g. a path
*.parent1.node
it would map on all nodes with name node that have been directly called by a node with the name parent1.
- function_code: str = <odmantic.field.FieldProxy object>¶
- function_mapping: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- pickle_function: FunctionPickle | None = <odmantic.field.FieldProxy object>¶
- regex_pattern: str = <odmantic.field.FieldProxy object>¶
- set_values(other: ArtifactMapping) ArtifactMapping¶
- class simstack.models.ArtifactModel(*, name: str, description: str | None = None, data: dict[str, ~typing.Any]=<factory>, path: str | None = None, id: ObjectId = <factory>)¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': 'artifacts', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- path: str | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.BinaryOperationInput(*, field_name: str = 'binary_operation', arg1: FloatData, arg2: FloatData, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.BooleanData(*, field_name: str = 'boolean', value: bool, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: bool = <odmantic.field.FieldProxy object>¶
- class simstack.models.DataSet(*, field_name: str = 'dataset', metadata: DataSetMetadata, sections: dict[str, ~simstack.models.dataset.DataSetSection]=<factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- property dataset_type: str¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- get(key: str, default: DataSetSection = None) DataSetSection[source]¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- items() ItemsView[str, DataSetSection][source]¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- metadata: DataSetMetadata = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- pop(key: str, default=None) DataSetSection[source]¶
- sections: dict[str, DataSetSection] = <odmantic.field.FieldProxy object>¶
- setdefault(key: str, default: DataSetSection = None) DataSetSection[source]¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- update(other: Dict[str, DataSetSection] | DataSet = None, **kwargs) None[source]¶
- values() ValuesView[DataSetSection][source]¶
- class simstack.models.DataSetMetadata(*, field_name: str, data: dict[str, str | int | float | bool | ~odmantic.bson._datetime]=<factory>, is_validated: bool = False, structure: dict[str, dict[str, str]]=<factory>)[source]¶
Bases:
EmbeddedModel- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: dict[str, str | int | float | bool | _datetime] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- property initialized: bool¶
Check if the model has been fully constructed.
- is_type_compatible(key: str, value) bool[source]¶
Check if a value is type-compatible with existing key.
- is_validated: bool = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- structure: dict[str, dict[str, str]] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.DataSetMetadataTemplate(*, dataset_type: str, model_json: dict[str, ~typing.Any], structure: dict[str, dict[str, str]] = <factory>, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
Model- dataset_type: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_json: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- structure: dict[str, dict[str, str]] = <odmantic.field.FieldProxy object>¶
- class simstack.models.DataSetSection(*, model_types: dict[str, str]=<factory>, data: dict[str, dict[str, ~odmantic.bson.ObjectId]]=<factory>, column_defs: list[dict[()]] = <factory>, table_entries: list[list[dict[()]]] = <factory>)[source]¶
Bases:
EmbeddedModelRepresents a section of a dataset containing dictionaries of models.
A DataSetSection is a list of dictionaries where for each key, the values are of the same model type.
- Variables:
model_types – Dictionary mapping keys to model class names.
data – Dictionary mapping names to dictionaries mapping keys to ObjectIds.
- add_row(item: Dict[str, Model | None], name: str | None = None) None[source]¶
Add a dictionary of models to this section.
- Parameters:
item – Dictionary of model instances to add.
name – Optional name for the item. If None, a UUID will be generated.
- Raises:
ValueError – If the model types don’t match the section’s expected types.
TypeError – If a non-None item value is not a Model instance.
- column_defs: list[dict[()]] = <odmantic.field.FieldProxy object>¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: dict[str, dict[str, ObjectId]] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- async load_to_cache(db: Database) None[source]¶
Load all items from the database into the cache assuming that data is already loaded.
- async make_column_defs()[source]¶
Generate ag-grid column definitions for all model types in this section.
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_types: dict[str, str] = <odmantic.field.FieldProxy object>¶
- table_entries: list[list[dict[()]]] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- update(other: Dict[str, Dict[str, Model | None]] | DataSetSection) None[source]¶
- class simstack.models.DataSetSelection(*, field_name: str = 'dataset_selection', dataset_id: ObjectId, dataset_selection_fields: list[DataSetSelectionField] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- dataset_id: ObjectId = <odmantic.field.FieldProxy object>¶
- dataset_selection_fields: list[DataSetSelectionField] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- get_selected_elements(section_name: str = None) List[Tuple[Model, ...]][source]¶
Retrieve all selected model groups from the dataset.
- Parameters:
section_name – Optional section name to filter results. If None, returns all sections.
- Returns:
List of tuples of model instances for all selected elements
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- class simstack.models.DataSetSelectionField(*, section_name: str = 'default', indices: list[int] = <factory>)[source]¶
Bases:
EmbeddedModel- indices: list[int] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- section_name: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.DataSetTuple(*, field_name: str = 'dataset', metadata: DataSetMetadata, sections: dict[str, ~simstack.models.datasettuple.DataSetTupleSection]=<factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async clone(new_field_name: str = None, exclude_sections: List[str] = None) DataSetTuple[source]¶
Clone the dataset with optionally a new field name and excluding specified sections.
- Parameters:
new_field_name – Optional new field name for the cloned dataset. If None, uses original field_name.
exclude_sections – Optional list of section names to exclude from the clone. If None, all sections are cloned.
- Returns:
A new DataSet instance that is a clone of this dataset
- collect_structure() Dict[str, Dict[str, str]][source]¶
Returns a dictionary where keys are section names and values are dictionaries mapping string indices to model types at those indices.
- Returns:
Dictionary mapping section names to their model type structures
- Return type:
Dict[str, Dict[str, str]]
- property dataset_type: str¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- get(key: str, default: DataSetTupleSection = None) DataSetTupleSection[source]¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- items() ItemsView[str, DataSetTupleSection][source]¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- metadata: DataSetMetadata = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- pop(key: str, default=None) DataSetTupleSection[source]¶
- popitem() Tuple[str, DataSetTupleSection][source]¶
- sections: dict[str, DataSetTupleSection] = <odmantic.field.FieldProxy object>¶
- setdefault(key: str, default: DataSetTupleSection = None) DataSetTupleSection[source]¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- update(other: Dict[str, DataSetTupleSection] | DataSetTuple = None, **kwargs) None[source]¶
- values() ValuesView[DataSetTupleSection][source]¶
- class simstack.models.DataSetTupleSection(*, model_types: list[str] = <factory>, data: list[list[ObjectId]] = <factory>, column_defs: list[dict[()]] = <factory>, table_entries: list[list[dict[()]]] = <factory>)[source]¶
Bases:
EmbeddedModelRepresents a section of a dataset containing tuples of models.
A DataSetSection is a list of tuples where all tuples contain the same types of models. For example, if one tuple contains (ModelA, ModelB), then all tuples in this section must contain (ModelA, ModelB) instances.
- Variables:
model_types – List of model class names that define the structure of each tuple.
data – List of tuples, where each tuple contains model IDs corresponding to model_types.
- async add_model_group(models: Model | Tuple[Model, ...]) None[source]¶
Add a tuple of models to this section.
- Parameters:
models – Tuple of model instances to add
- Raises:
ValueError – If the model types don’t match the section’s expected types
- async append(models: Tuple[Model, ...]) None[source]¶
Append a tuple of models to the section.
- Parameters:
models – Tuple of model instances to append
- column_defs: list[dict[()]] = <odmantic.field.FieldProxy object>¶
- count(models: Tuple[Model, ...]) int[source]¶
Return the number of occurrences of the specified tuple of models.
- Parameters:
models – Tuple of model instances to count
- Returns:
Number of occurrences
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: list[list[ObjectId]] = <odmantic.field.FieldProxy object>¶
- extend(models_list: List[Tuple[Model, ...]]) None[source]¶
Extend the section with multiple tuples of models.
- Parameters:
models_list – List of tuples of model instances to extend with
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- async get_all_model_groups() List[Tuple[Model, ...]][source]¶
Retrieve all tuples in this section.
- Returns:
List of tuples of model instances
- async get_model_group(index: int) Tuple[Model, ...][source]¶
Retrieve a tuple of models at the specified index.
- Parameters:
index – Index of the tuple to retrieve
- Returns:
Tuple of model instances
- async index(models: Tuple[Model, ...], start: int = 0, stop: int = None) int[source]¶
Return the index of the first occurrence of the specified tuple of models.
- Parameters:
models – Tuple of model instances to find
start – Start index for search
stop – Stop index for search
- Returns:
Index of the tuple
- Raises:
ValueError – If the tuple is not found
- async insert(index: int, models: Tuple[Model, ...]) None[source]¶
Insert a tuple of models at the specified index.
- Parameters:
index – Index to insert at
models – Tuple of model instances to insert
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- async make_column_defs()[source]¶
Generate ag-grid column definitions for all model types in this section.
- Returns:
List of column definitions for ag-grid
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_types: list[str] = <odmantic.field.FieldProxy object>¶
- async pop(index: int = -1) Tuple[Model, ...][source]¶
Remove and return a model group at the specified index (default last).
- Parameters:
index – Index to pop (default -1 for last)
- Returns:
Tuple of model instances that was removed
- async remove(models: Tuple[Model, ...]) None[source]¶
Remove the first occurrence of the specified tuple of models.
- Parameters:
models – Tuple of model instances to remove
- Raises:
ValueError – If the tuple is not found
- table_entries: list[list[dict[()]]] = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.DataSetTupleSelection(*, field_name: str = 'dataset_selection', dataset_id: ObjectId, dataset_selection_fields: list[DataSetTupleSelectionField] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- dataset_id: ObjectId = <odmantic.field.FieldProxy object>¶
- dataset_selection_fields: list[DataSetTupleSelectionField] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- async get_selected_elements(section_name: str = None) List[Tuple[Model, ...]][source]¶
Retrieve all selected model groups from the dataset.
- Parameters:
section_name – Optional section name to filter results. If None, returns all sections.
- Returns:
List of tuples of model instances for all selected elements
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- class simstack.models.DataSetTupleSelectionField(*, section_name: str = 'default', indices: list[int] = <factory>)[source]¶
Bases:
EmbeddedModel- indices: list[int] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- section_name: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.FileList(*, elements: list[ObjectId] = <factory>)[source]¶
Bases:
EmbeddedModel,ObjectListMixin[FileStack]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.FileListModel(*, elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[FileStack]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.FileStack(*, name: str | None = None, size: int | None = None, is_hashable: bool = False, hash: str | None = None, in_memory: bool = False, content: bytes | None = None, locations: list[FileInstance] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- append(file_instance: FileInstance) None[source]¶
Appends a FileInstance to the file stack.
- Parameters:
file_instance (FileInstance) – The FileInstance to append.
- content: bytes | None = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_local_file(path: Path | str, is_hashable: bool = True, in_memory: bool = True, secure_source: bool = False, task_id: str = '') FileStack[source]¶
Creates a FileStack object from a local file path.
- Parameters:
task_id (str) – task_id of the task that created the file stack, used for logging and tracking
secure_source (bool) – specifies if the source is secure (already in a directory generated within Simstack II)
path (Union[Path, str]) – The path to the local file. Can be provided as a string or Path object.
is_hashable (bool) – A flag indicating whether the file hash needs to be calculated.
in_memory (bool) – Whether to store the compressed file content in memory. Defaults to True.
- Returns:
A FileStack object containing FileInstances for the file.
- Return type:
- classmethod from_model(model: Model, **kwargs) Model¶
- get(local_dir: Path | None = None) Path[source]¶
Copies the file stack to a local directory. This is the version to be used in applications
- Parameters:
local_dir (Path) – The local directory to copy the file stack to.
- get_raw(local_resource: Resource, local_dir: Path | None = None) Path[source]¶
Copies the file stack to a local directory, assumes no context.
- Parameters:
local_resource – the local resource to copy the file stack to. Defaults to the current resource.
local_dir (Path) – The local directory to copy the file stack to.
- hash: str | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- in_memory: bool = <odmantic.field.FieldProxy object>¶
- is_hashable: bool = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- locations: list[FileInstance] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str | None = <odmantic.field.FieldProxy object>¶
- size: int | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.FireAndForgetResult(*, call_path: str, models: dict[str, ~typing.Any], success: bool, next_step: bool = False, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
ModelModel representing the result of a fire-and-forget task.
- call_path¶
The full call path of the node.
- Type:
str
- models¶
A dictionary mapping argument/result names to their values.
- Type:
dict[str, Any]
- success¶
Whether the task was successful.
- Type:
bool
- next_step¶
Whether this result triggers a next step.
- Type:
bool
- call_path: str = <odmantic.field.FieldProxy object>¶
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- models: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- next_step: bool = <odmantic.field.FieldProxy object>¶
- success: bool = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.FloatData(*, field_name: str = 'float', value: float, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: float = <odmantic.field.FieldProxy object>¶
- class simstack.models.Image2DArtifactModel(*, parent_id: ~odmantic.bson.ObjectId | None = None, name: str, description: str | None = None, format: ~typing.Literal['png', 'jpg', 'jpeg', 'svg', 'gif', 'bmp', 'webp'], data: bytes, width: int | None = None, height: int | None = None, metadata: dict[str, ~typing.Any] = <factory>, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
ModelModel for storing 2D image artifacts in MongoDB.
- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- data: bytes = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- format: Literal['png', 'jpg', 'jpeg', 'svg', 'gif', 'bmp', 'webp'] = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- height: int | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- metadata: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- parent_id: ObjectId | None = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- width: int | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.IntData(*, field_name: str = 'int', value: int, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: int = <odmantic.field.FieldProxy object>¶
- class simstack.models.IteratorInput(*, start: int, stop: int, generator: str = 'range', id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- generator: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- start: int = <odmantic.field.FieldProxy object>¶
- stop: int = <odmantic.field.FieldProxy object>¶
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.ModelMapping(*, name: str, mapping: str, version: str | None = None, collection_name: str, json_schema: str | None = None, ui_schema: str | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Modelname: shorthand - must be unique mapping: full name - path relative to project root in module.module.class/function format
- collection_name: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- json_schema: str | None = <odmantic.field.FieldProxy object>¶
- mapping: str = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- ui_schema: str | None = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.NamedDataReference(*, variable_name: str, variable_mapping: str, reference: ObjectId)[source]¶
Bases:
EmbeddedModel- classmethod from_variable(variable: Model, variable_name: str | None = None, task_id: str | None = None)[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- reference: ObjectId = <odmantic.field.FieldProxy object>¶
- variable_mapping: str = <odmantic.field.FieldProxy object>¶
- variable_name: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.NodeModel(*, name: str, function_mapping: str, version: str | None = None, input_mappings: list[~simstack.models.models.DataMapping], result_mappings: list[~simstack.models.models.DataMapping] = <factory>, called_nodes: list[str] = <factory>, description: str | None = '', favorite: bool = False, default_parameters: ~simstack.models.parameters.Parameters, pickle_function: ~simstack.models.pickle_models.FunctionPickle | None = None, id: ~odmantic.bson.ObjectId = <factory>)[source]¶
Bases:
Model- called_nodes: list[str] = <odmantic.field.FieldProxy object>¶
- default_parameters: Parameters = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- favorite: bool = <odmantic.field.FieldProxy object>¶
- function_mapping: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- input_mappings: list[DataMapping] = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'node_model', 'extra': None, 'indexes': None, 'json_encoders': {<class 'bytes'>: <function NodeModel.<lambda>>}, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- pickle_function: FunctionPickle | None = <odmantic.field.FieldProxy object>¶
- result_mappings: list[DataMapping] = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.NodeRegistry(*, name: str, status: TaskStatus, custom_name: str | None = None, version: str | None = None, project: ObjectId | None = None, category: str | None = None, description: str | None = None, call_path: str | None = None, assignment_rule_id: str | None = None, assignment_rule_name: str | None = None, assignment_pattern: str | None = None, error: str | None = None, message: str | None = None, input_references: list[NamedDataReference] = <factory>, results_references: list[NamedDataReference] = <factory>, info_files: FileList = <factory>, parent_ids: list[ObjectId] = <factory>, artifact_ids: list[ObjectId] = <factory>, created_at: _datetime = <factory>, started_at: _datetime | None = None, completed_at: _datetime | None = None, job_id: str | None = None, function_hash: str, arg_hash: str, func_mapping: str, is_async: bool = False, parameters: Parameters = <odmantic.reference.ODMReferenceInfo object>, id: ObjectId = <factory>)[source]¶
Bases:
ModelRepresents a registry for nodes with associated metadata, configurations, and status information. It allows tracking the state and attributes of a workflow node, including its execution parameters, process status, and relationship to other nodes.
This class is designed for managing workflow instances and their lifecycle, with capabilities to monitor execution states, inputs, outputs, and associated timestamps.
- Variables:
name – The name of the node.
custom_name – An optional custom name for the node.
status – TheTaskStatus of the node in string format.
category – An optional category classification for the node.
description – An optional description providing details about the node.
input_references – List of references to input data.
results_references – List of references to result data.
parent_ids – A list of identifiers representing parent nodes associated with this node.
created_at – The timestamp when the node was created.
started_at – An optional timestamp indicating when the execution of the node started.
completed_at – An optional timestamp indicating when the execution of the node was completed.
function_hash – A hash value representing the unique function executed by this node.
arg_hash – A hash value representing the unique arguments passed to the function of this node.
func_mapping – A mapping identifier associated with the function executed by this node.
is_async – A boolean value indicating whether the node execution is asynchronous.
parameters – Parameters associated with the node execution.
call_path – An optional path indicating where the function is called from by concatenating the name of all nodes in the call stack.
- arg_hash: str = <odmantic.field.FieldProxy object>¶
- artifact_ids: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- assignment_pattern: str | None = <odmantic.field.FieldProxy object>¶
- assignment_rule_id: str | None = <odmantic.field.FieldProxy object>¶
- assignment_rule_name: str | None = <odmantic.field.FieldProxy object>¶
- call_path: str | None = <odmantic.field.FieldProxy object>¶
- category: str | None = <odmantic.field.FieldProxy object>¶
- completed_at: _datetime | None = <odmantic.field.FieldProxy object>¶
- created_at: _datetime = <odmantic.field.FieldProxy object>¶
- custom_name: str | None = <odmantic.field.FieldProxy object>¶
- description: str | None = <odmantic.field.FieldProxy object>¶
- error: str | None = <odmantic.field.FieldProxy object>¶
- func_mapping: str = <odmantic.field.FieldProxy object>¶
- function_hash: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- input_references: list[NamedDataReference] = <odmantic.field.FieldProxy object>¶
- is_async: bool = <odmantic.field.FieldProxy object>¶
- job_id: str | None = <odmantic.field.FieldProxy object>¶
- message: str | None = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- parameters: Parameters = <odmantic.field.FieldProxy object>¶
- parent_ids: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- project: ObjectId | None = <odmantic.field.FieldProxy object>¶
- results_references: list[NamedDataReference] = <odmantic.field.FieldProxy object>¶
- started_at: _datetime | None = <odmantic.field.FieldProxy object>¶
- status: TaskStatus = <odmantic.field.FieldProxy object>¶
- version: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.Parameters(*, force_rerun: bool = False, resource: Resource = <factory>, queue: str = 'default', recompute_artifacts: bool | None = False, docker_image: str | None = None, other_value: str = 'other', test_dict: dict[str, ~typing.Any]=<factory>, slurm_parameters: SlurmParameters = None)[source]¶
Bases:
EmbeddedModel- docker_image: str | None = <odmantic.field.FieldProxy object>¶
- force_rerun: bool = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': {'description': 'Parameters for running a simulation', 'examples': [{'queue': 'default', 'resource': 'self', 'slurm_parameters': {'nodes': 2}}], 'title': 'Parameters'}, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- other_value: str = <odmantic.field.FieldProxy object>¶
- queue: str = <odmantic.field.FieldProxy object>¶
- recompute_artifacts: bool | None = <odmantic.field.FieldProxy object>¶
- slurm_parameters: SlurmParameters = <odmantic.field.FieldProxy object>¶
- test_dict: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- classmethod validate_resource(v)[source]¶
Validate and convert resource input to a Resource object.
Accepts string, Resource objects, and dictionary representations. If a string is provided, converts it to a Resource object. If a dictionary is provided (e.g., during deserialization), extracts the value and creates a Resource object.
- Parameters:
v – The value to validate (str, Resource, or dict)
- Returns:
The validated Resource object
- Return type:
- class simstack.models.Project(*, field_name: str, description: str | None = None, tag_ids: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model- description: str | None = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'projects', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- tag_ids: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- class simstack.models.ResourceAssignmentRule(*, name: str, regex_pattern: str, priority: int = 0, enabled: bool = True, resource_str: str | None = None, queue: str | None = None, slurm_parameters_patch: dict[str, ~typing.Any]=<factory>, description: str | None = '', id: ObjectId = <factory>)[source]¶
Bases:
Model- description: str | None = <odmantic.field.FieldProxy object>¶
- enabled: bool = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'resource_assignment_rule', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶
- priority: int = <odmantic.field.FieldProxy object>¶
- queue: str | None = <odmantic.field.FieldProxy object>¶
- regex_pattern: str = <odmantic.field.FieldProxy object>¶
- resource_str: str | None = <odmantic.field.FieldProxy object>¶
- slurm_parameters_patch: dict[str, Any] = <odmantic.field.FieldProxy object>¶
- class simstack.models.SlurmParametersPatch(*, nodes: Annotated[int | None, Ge(ge=1)] = None, tasks: Annotated[int | None, Ge(ge=1)] = None, tasks_per_node: Annotated[int | None, Ge(ge=1)] = None, cpus_per_task: Annotated[int | None, Ge(ge=1)] = None, mem: str | None = None, mem_per_cpu: str | None = None, time: str | None = None, begin: str | None = None, partition: str | None = None, qos: str | None = None, job_name: str | None = None, output: str | None = None, error: str | None = None, mail_type: str | None = None, mail_user: str | None = None, gres: str | None = None, account: str | None = None, priority: int | None = None, reservation: str | None = None, constraint: str | None = None, exclusive: bool | None = None, nice: int | None = None, dependency: str | None = None, array: str | None = None, startup_commands: list[str] | None = None, chdir: str | None = None, export: str | None = None, signal: str | None = None, requeue: bool | None = None, no_requeue: bool | None = None)[source]¶
Bases:
EmbeddedModel- account: str | None = <odmantic.field.FieldProxy object>¶
- array: str | None = <odmantic.field.FieldProxy object>¶
- begin: str | None = <odmantic.field.FieldProxy object>¶
- chdir: str | None = <odmantic.field.FieldProxy object>¶
- constraint: str | None = <odmantic.field.FieldProxy object>¶
- cpus_per_task: int | None = <odmantic.field.FieldProxy object>¶
- dependency: str | None = <odmantic.field.FieldProxy object>¶
- error: str | None = <odmantic.field.FieldProxy object>¶
- exclusive: bool | None = <odmantic.field.FieldProxy object>¶
- export: str | None = <odmantic.field.FieldProxy object>¶
- gres: str | None = <odmantic.field.FieldProxy object>¶
- job_name: str | None = <odmantic.field.FieldProxy object>¶
- mail_type: str | None = <odmantic.field.FieldProxy object>¶
- mail_user: str | None = <odmantic.field.FieldProxy object>¶
- mem: str | None = <odmantic.field.FieldProxy object>¶
- mem_per_cpu: str | None = <odmantic.field.FieldProxy object>¶
- model_config: ClassVar[Dict[str, Any]] = {'arbitrary_types_allowed': False, 'collection': None, 'extra': 'forbid', 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- nice: int | None = <odmantic.field.FieldProxy object>¶
- no_requeue: bool | None = <odmantic.field.FieldProxy object>¶
- nodes: int | None = <odmantic.field.FieldProxy object>¶
- output: str | None = <odmantic.field.FieldProxy object>¶
- partition: str | None = <odmantic.field.FieldProxy object>¶
- priority: int | None = <odmantic.field.FieldProxy object>¶
- qos: str | None = <odmantic.field.FieldProxy object>¶
- requeue: bool | None = <odmantic.field.FieldProxy object>¶
- reservation: str | None = <odmantic.field.FieldProxy object>¶
- signal: str | None = <odmantic.field.FieldProxy object>¶
- startup_commands: list[str] | None = <odmantic.field.FieldProxy object>¶
- tasks: int | None = <odmantic.field.FieldProxy object>¶
- tasks_per_node: int | None = <odmantic.field.FieldProxy object>¶
- time: str | None = <odmantic.field.FieldProxy object>¶
- class simstack.models.StringData(*, field_name: str = 'text', value: str, id: ObjectId = <factory>)[source]¶
Bases:
Model- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- make_column_defs_instance(table_name=None, max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- make_table_entries(max_recursion_level=1, drop_id=True, current_level=0, visited=None, field_prefix='')[source]¶
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- value: str = <odmantic.field.FieldProxy object>¶
- class simstack.models.StringDataList(*, field_name: str = 'string_data_list', elements: list[ObjectId] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,ObjectListMixin[StringData]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[ObjectId] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.StringList(*, field_name: str = 'string_list', elements: list[str] = <factory>, id: ObjectId = <factory>)[source]¶
Bases:
Model,GenericListMixin[str]- async custom_model_dump(**kwargs) Dict[str, Any]¶
Custom model dump method to handle the conversion of model instances to dictionaries. This method recursively traverses dictionaries and lists to convert any nested model instances to their dictionary representation.
- Parameters:
self – The model instance
kwargs – Additional keyword arguments
- Returns:
A dictionary representation of the model instance
- elements: list[str] = <odmantic.field.FieldProxy object>¶
- field_name: str = <odmantic.field.FieldProxy object>¶
- classmethod from_dict(data: dict, **kwargs) Any¶
Create an instance of the model from a dictionary. Handles nested models and enum values.
- classmethod from_model(model: Model, **kwargs) Model¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- classmethod json_schema()¶
Generates a JSON schema for the given class and its fields, but eliminates all fields which are models, embedded models, or references to models.
- Parameters:
cls
- Returns:
- model_config = {'arbitrary_types_allowed': False, 'collection': None, 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod ui_make_title(ui_schema: Dict[str, Any], field: str, title: str) dict¶
Adds a title to the JSON schema.
- Parameters:
cls – The class to which the JSON schema belongs
ui_schema – The original ui_schema schema
title – Title to be added
- Returns:
Modified JSON schema with title
- classmethod ui_schema()¶
Generates a UI schema that uses GenericForm for fields with ui_schema function. Also preserves any existing UI schema configurations from the class.
- Parameters:
cls – The model class to generate UI schema for
- Returns:
The generated UI schema
- Return type:
dict
- class simstack.models.Tag(*, name: str, description: str | None = None, id: ObjectId = <factory>)[source]¶
Bases:
Model- description: str | None = <odmantic.field.FieldProxy object>¶
- id: ObjectId = <odmantic.field.FieldProxy object>¶
- model_config = {'arbitrary_types_allowed': False, 'collection': 'tags', 'extra': None, 'indexes': None, 'json_schema_extra': None, 'parse_doc_with_default_factories': False, 'str_strip_whitespace': False, 'title': None, 'validate_assignment': True, 'validate_default': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str = <odmantic.field.FieldProxy object>¶