simstack 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simstack/__init__.py +0 -0
- simstack/_version.py +24 -0
- simstack/core/__init__.py +0 -0
- simstack/core/artifacts.py +406 -0
- simstack/core/asnyc_helper.py +14 -0
- simstack/core/config_file.py +60 -0
- simstack/core/context.py +283 -0
- simstack/core/definitions.py +22 -0
- simstack/core/engine.py +115 -0
- simstack/core/find_simstack_modules.py +41 -0
- simstack/core/hash.py +179 -0
- simstack/core/node.py +1137 -0
- simstack/core/node_claim.py +31 -0
- simstack/core/node_runner.py +362 -0
- simstack/core/process_results.py +102 -0
- simstack/core/recompute_artifacts.py +117 -0
- simstack/core/reset_db.py +12 -0
- simstack/core/resource_assignment.py +222 -0
- simstack/core/resources.py +90 -0
- simstack/core/route_table.py +24 -0
- simstack/core/run_docker.py +109 -0
- simstack/core/run_node.py +71 -0
- simstack/core/runner.py +169 -0
- simstack/core/services/__init__.py +11 -0
- simstack/core/services/base_service.py +191 -0
- simstack/core/services/file_transfer_service.py +117 -0
- simstack/core/services/git_restart_service.py +12 -0
- simstack/core/services/git_uv_update_service.py +105 -0
- simstack/core/services/node_execution_service.py +182 -0
- simstack/core/services/resource_branch_monitor_service.py +71 -0
- simstack/core/services/runner_cleanup_service.py +149 -0
- simstack/core/services/runner_manager.py +163 -0
- simstack/core/services/runner_status_service.py +10 -0
- simstack/core/services/slurm_status_service.py +67 -0
- simstack/core/services/stop_check_service.py +27 -0
- simstack/core/services/timeout_restart_service.py +26 -0
- simstack/core/simstack_result.py +39 -0
- simstack/core/submit_node.py +217 -0
- simstack/core/task_id.py +22 -0
- simstack/methods/__init__.py +0 -0
- simstack/methods/archive_files.py +292 -0
- simstack/methods/fire_and_forget_runner.py +113 -0
- simstack/methods/generate_test.py +125 -0
- simstack/methods/get_file.py +26 -0
- simstack/methods/mass_runner.py +154 -0
- simstack/methods/multiple_executor.py +307 -0
- simstack/methods/switch_git.py +16 -0
- simstack/methods/upload_helpers.py +81 -0
- simstack/models/__init__.py +74 -0
- simstack/models/array_list.py +21 -0
- simstack/models/array_storage.py +83 -0
- simstack/models/artifact_models.py +127 -0
- simstack/models/base_lists.py +51 -0
- simstack/models/base_types.py +209 -0
- simstack/models/charts_artifact.py +690 -0
- simstack/models/dataset.py +451 -0
- simstack/models/dataset_metadata.py +390 -0
- simstack/models/datasettuple.py +587 -0
- simstack/models/file_instance.py +150 -0
- simstack/models/file_list.py +45 -0
- simstack/models/files.py +424 -0
- simstack/models/fire_and_forget_result.py +19 -0
- simstack/models/images2d.py +113 -0
- simstack/models/log_entry_model.py +37 -0
- simstack/models/models.py +52 -0
- simstack/models/named_data_reference.py +36 -0
- simstack/models/node_registry.py +96 -0
- simstack/models/pandas_model.py +239 -0
- simstack/models/parameters.py +402 -0
- simstack/models/pickle_models.py +300 -0
- simstack/models/project.py +13 -0
- simstack/models/resource_assignment.py +170 -0
- simstack/models/resource_definition.py +125 -0
- simstack/models/runner_model.py +39 -0
- simstack/models/simple_table.py +79 -0
- simstack/models/simstack_model.py +97 -0
- simstack/models/slurm_info.py +17 -0
- simstack/models/table_artifact.py +87 -0
- simstack/models/tag.py +12 -0
- simstack/models/unused_test_file.py +5 -0
- simstack/simstack_marker.com +1 -0
- simstack/static/docs/.buildinfo +4 -0
- simstack/static/docs/_images/GUI Concept.webp +0 -0
- simstack/static/docs/_modules/index.html +434 -0
- simstack/static/docs/_modules/simstack/core/artifacts.html +743 -0
- simstack/static/docs/_modules/simstack/core/asnyc_helper.html +330 -0
- simstack/static/docs/_modules/simstack/core/config_file.html +379 -0
- simstack/static/docs/_modules/simstack/core/definitions.html +341 -0
- simstack/static/docs/_modules/simstack/core/engine.html +437 -0
- simstack/static/docs/_modules/simstack/core/find_simstack_modules.html +360 -0
- simstack/static/docs/_modules/simstack/core/hash.html +528 -0
- simstack/static/docs/_modules/simstack/core/node.html +1392 -0
- simstack/static/docs/_modules/simstack/core/node_claim.html +347 -0
- simstack/static/docs/_modules/simstack/core/node_runner.html +711 -0
- simstack/static/docs/_modules/simstack/core/process_results.html +418 -0
- simstack/static/docs/_modules/simstack/core/recompute_artifacts.html +433 -0
- simstack/static/docs/_modules/simstack/core/reset_db.html +328 -0
- simstack/static/docs/_modules/simstack/core/resource_assignment.html +553 -0
- simstack/static/docs/_modules/simstack/core/resources.html +424 -0
- simstack/static/docs/_modules/simstack/core/route_table.html +349 -0
- simstack/static/docs/_modules/simstack/core/run_docker.html +425 -0
- simstack/static/docs/_modules/simstack/core/run_node.html +390 -0
- simstack/static/docs/_modules/simstack/core/runner.html +491 -0
- simstack/static/docs/_modules/simstack/core/services/base_service.html +522 -0
- simstack/static/docs/_modules/simstack/core/services/file_transfer_service.html +436 -0
- simstack/static/docs/_modules/simstack/core/services/git_restart_service.html +331 -0
- simstack/static/docs/_modules/simstack/core/services/git_uv_update_service.html +427 -0
- simstack/static/docs/_modules/simstack/core/services/node_execution_service.html +507 -0
- simstack/static/docs/_modules/simstack/core/services/resource_branch_monitor_service.html +390 -0
- simstack/static/docs/_modules/simstack/core/services/runner_cleanup_service.html +468 -0
- simstack/static/docs/_modules/simstack/core/services/runner_manager.html +485 -0
- simstack/static/docs/_modules/simstack/core/services/runner_status_service.html +329 -0
- simstack/static/docs/_modules/simstack/core/services/slurm_status_service.html +386 -0
- simstack/static/docs/_modules/simstack/core/services/stop_check_service.html +346 -0
- simstack/static/docs/_modules/simstack/core/services/timeout_restart_service.html +345 -0
- simstack/static/docs/_modules/simstack/core/simstack_result.html +355 -0
- simstack/static/docs/_modules/simstack/core/submit_node.html +536 -0
- simstack/static/docs/_modules/simstack/core/task_id.html +344 -0
- simstack/static/docs/_modules/simstack/methods/archive_files.html +598 -0
- simstack/static/docs/_modules/simstack/methods/fire_and_forget_runner.html +432 -0
- simstack/static/docs/_modules/simstack/methods/generate_test.html +443 -0
- simstack/static/docs/_modules/simstack/methods/get_file.html +342 -0
- simstack/static/docs/_modules/simstack/methods/mass_runner.html +476 -0
- simstack/static/docs/_modules/simstack/methods/multiple_executor.html +674 -0
- simstack/static/docs/_modules/simstack/methods/switch_git.html +332 -0
- simstack/static/docs/_modules/simstack/methods/upload_helpers.html +403 -0
- simstack/static/docs/_modules/simstack/models/array_list.html +337 -0
- simstack/static/docs/_modules/simstack/models/array_storage.html +417 -0
- simstack/static/docs/_modules/simstack/models/base_lists.html +374 -0
- simstack/static/docs/_modules/simstack/models/base_types.html +588 -0
- simstack/static/docs/_modules/simstack/models/charts_artifact.html +1035 -0
- simstack/static/docs/_modules/simstack/models/dataset.html +866 -0
- simstack/static/docs/_modules/simstack/models/dataset_metadata.html +711 -0
- simstack/static/docs/_modules/simstack/models/datasettuple.html +1005 -0
- simstack/static/docs/_modules/simstack/models/file_instance.html +472 -0
- simstack/static/docs/_modules/simstack/models/file_list.html +367 -0
- simstack/static/docs/_modules/simstack/models/files.html +773 -0
- simstack/static/docs/_modules/simstack/models/fire_and_forget_result.html +335 -0
- simstack/static/docs/_modules/simstack/models/images2d.html +447 -0
- simstack/static/docs/_modules/simstack/models/log_entry_model.html +356 -0
- simstack/static/docs/_modules/simstack/models/models.html +374 -0
- simstack/static/docs/_modules/simstack/models/named_data_reference.html +355 -0
- simstack/static/docs/_modules/simstack/models/node_registry.html +415 -0
- simstack/static/docs/_modules/simstack/models/pandas_model.html +570 -0
- simstack/static/docs/_modules/simstack/models/parameters.html +739 -0
- simstack/static/docs/_modules/simstack/models/pickle_models.html +631 -0
- simstack/static/docs/_modules/simstack/models/project.html +329 -0
- simstack/static/docs/_modules/simstack/models/resource_assignment.html +501 -0
- simstack/static/docs/_modules/simstack/models/resource_definition.html +477 -0
- simstack/static/docs/_modules/simstack/models/runner_model.html +361 -0
- simstack/static/docs/_modules/simstack/models/simple_table.html +413 -0
- simstack/static/docs/_modules/simstack/models/simstack_model.html +416 -0
- simstack/static/docs/_modules/simstack/models/slurm_info.html +333 -0
- simstack/static/docs/_modules/simstack/models/table_artifact.html +406 -0
- simstack/static/docs/_modules/simstack/models/tag.html +328 -0
- simstack/static/docs/_modules/simstack/tables/model_table.html +519 -0
- simstack/static/docs/_modules/simstack/tables/node_children.html +538 -0
- simstack/static/docs/_modules/simstack/tables/node_table.html +854 -0
- simstack/static/docs/_modules/simstack/tables/table_builder.html +642 -0
- simstack/static/docs/_modules/simstack/util/async_zip_utils.html +337 -0
- simstack/static/docs/_modules/simstack/util/b64mixin.html +339 -0
- simstack/static/docs/_modules/simstack/util/cleaned_json_schema.html +336 -0
- simstack/static/docs/_modules/simstack/util/config_reader.html +498 -0
- simstack/static/docs/_modules/simstack/util/custom_model_dump.html +391 -0
- simstack/static/docs/_modules/simstack/util/database_information.html +488 -0
- simstack/static/docs/_modules/simstack/util/db.html +1392 -0
- simstack/static/docs/_modules/simstack/util/db_logger.html +448 -0
- simstack/static/docs/_modules/simstack/util/default_from_dict.html +376 -0
- simstack/static/docs/_modules/simstack/util/directory_iterator.html +553 -0
- simstack/static/docs/_modules/simstack/util/docstring_parser.html +526 -0
- simstack/static/docs/_modules/simstack/util/file_hashing.html +394 -0
- simstack/static/docs/_modules/simstack/util/file_transfer_client.html +791 -0
- simstack/static/docs/_modules/simstack/util/files.html +733 -0
- simstack/static/docs/_modules/simstack/util/find_python_files.html +349 -0
- simstack/static/docs/_modules/simstack/util/generate_ui_schema.html +396 -0
- simstack/static/docs/_modules/simstack/util/generic_list_mixin.html +487 -0
- simstack/static/docs/_modules/simstack/util/get_module_path.html +336 -0
- simstack/static/docs/_modules/simstack/util/git_pull.html +381 -0
- simstack/static/docs/_modules/simstack/util/git_repository_status.html +411 -0
- simstack/static/docs/_modules/simstack/util/import_module.html +377 -0
- simstack/static/docs/_modules/simstack/util/importer.html +637 -0
- simstack/static/docs/_modules/simstack/util/init_data_source.html +357 -0
- simstack/static/docs/_modules/simstack/util/make_graph.html +423 -0
- simstack/static/docs/_modules/simstack/util/make_table.html +1171 -0
- simstack/static/docs/_modules/simstack/util/mappings.html +378 -0
- simstack/static/docs/_modules/simstack/util/minimal_route_finder.html +388 -0
- simstack/static/docs/_modules/simstack/util/mock_db.html +472 -0
- simstack/static/docs/_modules/simstack/util/module_path_checker.html +354 -0
- simstack/static/docs/_modules/simstack/util/object_list_mixin.html +649 -0
- simstack/static/docs/_modules/simstack/util/path_manager.html +566 -0
- simstack/static/docs/_modules/simstack/util/project_root_finder.html +357 -0
- simstack/static/docs/_modules/simstack/util/queue_watcher.html +593 -0
- simstack/static/docs/_modules/simstack/util/resource_config.html +532 -0
- simstack/static/docs/_modules/simstack/util/route_finder.html +390 -0
- simstack/static/docs/_modules/simstack/util/runner_util.html +487 -0
- simstack/static/docs/_modules/simstack/util/runner_utils.html +468 -0
- simstack/static/docs/_modules/simstack/util/safe_code_executor.html +510 -0
- simstack/static/docs/_modules/simstack/util/sample_config.html +414 -0
- simstack/static/docs/_modules/simstack/util/sensitive_content_filter.html +364 -0
- simstack/static/docs/_modules/simstack/util/setup_logging.html +365 -0
- simstack/static/docs/_modules/simstack/util/submit_to_watchdog.html +425 -0
- simstack/static/docs/_modules/simstack/util/toml_reader.html +482 -0
- simstack/static/docs/_modules/simstack/util/transform_file_name.html +357 -0
- simstack/static/docs/_modules/simstack/util/ui_tools.html +541 -0
- simstack/static/docs/_sources/architecture.rst.txt +25 -0
- simstack/static/docs/_sources/array_lists.rst.txt +60 -0
- simstack/static/docs/_sources/ci_pipeline.rst.txt +34 -0
- simstack/static/docs/_sources/data.rst.txt +175 -0
- simstack/static/docs/_sources/database_migrations.rst.txt +310 -0
- simstack/static/docs/_sources/datasets.rst.txt +93 -0
- simstack/static/docs/_sources/developer_guide.rst.txt +25 -0
- simstack/static/docs/_sources/docker_nodes.rst.txt +149 -0
- simstack/static/docs/_sources/files.rst.txt +159 -0
- simstack/static/docs/_sources/fire_and_forget_runner.rst.txt +67 -0
- simstack/static/docs/_sources/index.rst.txt +25 -0
- simstack/static/docs/_sources/installation.rst.txt +213 -0
- simstack/static/docs/_sources/lists.rst.txt +111 -0
- simstack/static/docs/_sources/mass_runner.rst.txt +91 -0
- simstack/static/docs/_sources/misc.rst.txt +106 -0
- simstack/static/docs/_sources/overview.rst.txt +91 -0
- simstack/static/docs/_sources/recovery.rst.txt +38 -0
- simstack/static/docs/_sources/resource_config.rst.txt +141 -0
- simstack/static/docs/_sources/simstack/modules/modules.rst.txt +7 -0
- simstack/static/docs/_sources/simstack/modules/simstack.core.rst.txt +205 -0
- simstack/static/docs/_sources/simstack/modules/simstack.core.services.rst.txt +109 -0
- simstack/static/docs/_sources/simstack/modules/simstack.methods.rst.txt +77 -0
- simstack/static/docs/_sources/simstack/modules/simstack.models.rst.txt +261 -0
- simstack/static/docs/_sources/simstack/modules/simstack.rst.txt +22 -0
- simstack/static/docs/_sources/simstack/modules/simstack.tables.rst.txt +45 -0
- simstack/static/docs/_sources/simstack/modules/simstack.util.rst.txt +381 -0
- simstack/static/docs/_sources/submit.rst.txt +141 -0
- simstack/static/docs/_sources/tables.rst.txt +50 -0
- simstack/static/docs/_sources/testing_complex_nodes.rst.txt +92 -0
- simstack/static/docs/_sources/ui_documentation.rst.txt +272 -0
- simstack/static/docs/_sources/workflows.rst.txt +446 -0
- simstack/static/docs/_static/base-stemmer.js +476 -0
- simstack/static/docs/_static/basic.css +906 -0
- simstack/static/docs/_static/cobalt2-theme.css +1 -0
- simstack/static/docs/_static/debug.css +69 -0
- simstack/static/docs/_static/docs-build-badge.css +51 -0
- simstack/static/docs/_static/docs-build-badge.js +51 -0
- simstack/static/docs/_static/doctools.js +150 -0
- simstack/static/docs/_static/documentation_options.js +13 -0
- simstack/static/docs/_static/english-stemmer.js +1066 -0
- simstack/static/docs/_static/file.png +0 -0
- simstack/static/docs/_static/language_data.js +13 -0
- simstack/static/docs/_static/minus.png +0 -0
- simstack/static/docs/_static/plus.png +0 -0
- simstack/static/docs/_static/pygments.css +250 -0
- simstack/static/docs/_static/scripts/furo-extensions.js +0 -0
- simstack/static/docs/_static/scripts/furo.js +3 -0
- simstack/static/docs/_static/scripts/furo.js.LICENSE.txt +7 -0
- simstack/static/docs/_static/scripts/furo.js.map +1 -0
- simstack/static/docs/_static/searchtools.js +693 -0
- simstack/static/docs/_static/skeleton.css +296 -0
- simstack/static/docs/_static/sphinx_highlight.js +159 -0
- simstack/static/docs/_static/styles/furo-extensions.css +2 -0
- simstack/static/docs/_static/styles/furo-extensions.css.map +1 -0
- simstack/static/docs/_static/styles/furo.css +2 -0
- simstack/static/docs/_static/styles/furo.css.map +1 -0
- simstack/static/docs/architecture.html +340 -0
- simstack/static/docs/array_lists.html +678 -0
- simstack/static/docs/ci_pipeline.html +385 -0
- simstack/static/docs/data.html +545 -0
- simstack/static/docs/database_migrations.html +652 -0
- simstack/static/docs/datasets.html +1268 -0
- simstack/static/docs/developer_guide.html +359 -0
- simstack/static/docs/docker_nodes.html +503 -0
- simstack/static/docs/files.html +718 -0
- simstack/static/docs/fire_and_forget_runner.html +641 -0
- simstack/static/docs/genindex.html +6390 -0
- simstack/static/docs/index.html +516 -0
- simstack/static/docs/installation.html +553 -0
- simstack/static/docs/lists.html +478 -0
- simstack/static/docs/mass_runner.html +481 -0
- simstack/static/docs/misc.html +454 -0
- simstack/static/docs/objects.inv +0 -0
- simstack/static/docs/overview.html +469 -0
- simstack/static/docs/py-modindex.html +1111 -0
- simstack/static/docs/recovery.html +371 -0
- simstack/static/docs/resource_config.html +590 -0
- simstack/static/docs/search.html +327 -0
- simstack/static/docs/searchindex.js +1 -0
- simstack/static/docs/simstack/modules/modules.html +489 -0
- simstack/static/docs/simstack/modules/simstack.core.html +1883 -0
- simstack/static/docs/simstack/modules/simstack.core.services.html +698 -0
- simstack/static/docs/simstack/modules/simstack.html +3060 -0
- simstack/static/docs/simstack/modules/simstack.methods.html +1150 -0
- simstack/static/docs/simstack/modules/simstack.models.html +13113 -0
- simstack/static/docs/simstack/modules/simstack.tables.html +635 -0
- simstack/static/docs/simstack/modules/simstack.util.html +3320 -0
- simstack/static/docs/submit.html +487 -0
- simstack/static/docs/tables.html +539 -0
- simstack/static/docs/testing_complex_nodes.html +458 -0
- simstack/static/docs/ui_documentation.html +788 -0
- simstack/static/docs/workflows.html +766 -0
- simstack/tables/__init__.py +0 -0
- simstack/tables/model_table.py +191 -0
- simstack/tables/node_children.py +219 -0
- simstack/tables/node_table.py +517 -0
- simstack/tables/table_builder.py +314 -0
- simstack/util/__init__.py +0 -0
- simstack/util/async_zip_utils.py +18 -0
- simstack/util/b64mixin.py +23 -0
- simstack/util/cleaned_json_schema.py +20 -0
- simstack/util/config_reader.py +179 -0
- simstack/util/custom_model_dump.py +75 -0
- simstack/util/database_information.py +160 -0
- simstack/util/db.py +1013 -0
- simstack/util/db_logger.py +117 -0
- simstack/util/default_from_dict.py +57 -0
- simstack/util/directory_iterator.py +216 -0
- simstack/util/docstring_parser.py +186 -0
- simstack/util/file_hashing.py +72 -0
- simstack/util/file_transfer_client.py +427 -0
- simstack/util/files.py +396 -0
- simstack/util/find_python_files.py +33 -0
- simstack/util/generate_ui_schema.py +80 -0
- simstack/util/generic_list_mixin.py +120 -0
- simstack/util/geometry_utils.py +118 -0
- simstack/util/get_module_path.py +20 -0
- simstack/util/git_pull.py +65 -0
- simstack/util/git_repository_status.py +95 -0
- simstack/util/import_module.py +63 -0
- simstack/util/importer.py +312 -0
- simstack/util/init_data_source.py +41 -0
- simstack/util/make_graph.py +107 -0
- simstack/util/make_table.py +837 -0
- simstack/util/mappings.py +41 -0
- simstack/util/minimal_route_finder.py +72 -0
- simstack/util/mock_db.py +144 -0
- simstack/util/module_path_checker.py +38 -0
- simstack/util/object_list_mixin.py +282 -0
- simstack/util/path_manager.py +223 -0
- simstack/util/project_root_finder.py +41 -0
- simstack/util/queue_watcher.py +262 -0
- simstack/util/resource_config.py +198 -0
- simstack/util/route_finder.py +74 -0
- simstack/util/runner_util.py +166 -0
- simstack/util/runner_utils.py +143 -0
- simstack/util/safe_code_executor.py +194 -0
- simstack/util/sample_config.py +98 -0
- simstack/util/sensitive_content_filter.py +48 -0
- simstack/util/setup_logging.py +49 -0
- simstack/util/submit_to_watchdog.py +106 -0
- simstack/util/toml_reader.py +142 -0
- simstack/util/transform_file_name.py +41 -0
- simstack/util/ui_tools.py +213 -0
- simstack-2.0.1.dist-info/METADATA +454 -0
- simstack-2.0.1.dist-info/RECORD +354 -0
- simstack-2.0.1.dist-info/WHEEL +5 -0
- simstack-2.0.1.dist-info/entry_points.txt +12 -0
- simstack-2.0.1.dist-info/licenses/LICENSE +21 -0
- simstack-2.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
from typing import Dict, Any, List
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def ui_hide_fields(ui_schema: Dict[str, Any], fields: str | List[str]) -> dict:
|
|
5
|
+
"""
|
|
6
|
+
Hides specified fields in the JSON schema.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
ui_schema: The original JSON schema
|
|
10
|
+
fields: List of field names to hide
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
local_fields = [fields] if isinstance(fields, str) else fields
|
|
14
|
+
# Iterate through the fields to hide
|
|
15
|
+
for field in local_fields:
|
|
16
|
+
ui_schema[field] = {"ui:widget": "hidden"}
|
|
17
|
+
return ui_schema
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def ui_make_properties_optional(
|
|
21
|
+
json_schema: Dict[str, Any], properties: List[str], option_field: str = "Show More"
|
|
22
|
+
) -> dict:
|
|
23
|
+
"""
|
|
24
|
+
Modifies a JSON schema to make specified properties visible only when an option is enabled.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
cls: The class to which the JSON schema belongs
|
|
28
|
+
json_schema: The original JSON schema
|
|
29
|
+
properties: List of property names to make optional
|
|
30
|
+
option_field: Name of the boolean field that controls visibility
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Modified JSON schema with dependencies
|
|
34
|
+
"""
|
|
35
|
+
# Add the option field
|
|
36
|
+
|
|
37
|
+
if option_field in json_schema["properties"]:
|
|
38
|
+
assert json_schema["properties"][option_field]["type"] == "boolean"
|
|
39
|
+
else:
|
|
40
|
+
json_schema["properties"][option_field] = {
|
|
41
|
+
"type": "boolean",
|
|
42
|
+
"title": option_field,
|
|
43
|
+
"default": False,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Create dependencies object if it doesn't exist
|
|
47
|
+
if "dependencies" not in json_schema:
|
|
48
|
+
json_schema["dependencies"] = {}
|
|
49
|
+
|
|
50
|
+
new_props = {}
|
|
51
|
+
for prop in properties:
|
|
52
|
+
if prop not in json_schema["properties"]:
|
|
53
|
+
raise ValueError(f"Property {prop} is not in json_schema")
|
|
54
|
+
new_props[prop] = json_schema["properties"][prop]
|
|
55
|
+
del json_schema["properties"][prop]
|
|
56
|
+
|
|
57
|
+
# Add dependency rules for each property
|
|
58
|
+
sub_schema = {"properties": {option_field: {"enum": [True]}, **new_props}}
|
|
59
|
+
json_schema["dependencies"][option_field] = {
|
|
60
|
+
"oneOf": [
|
|
61
|
+
{
|
|
62
|
+
"properties": {
|
|
63
|
+
option_field: {"enum": [False]},
|
|
64
|
+
**{prop: {"type": "null"} for prop in properties},
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
sub_schema,
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return sub_schema
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
#
|
|
75
|
+
# def ui_make_dependencies_optional(cls, json_schema: Dict[str, Any], option_field_path: List[str],
|
|
76
|
+
# properties: List[str], new_option_field: str = "Show More Details") -> Dict[str, Any]:
|
|
77
|
+
# """
|
|
78
|
+
# Makes properties optional within an already optional section at any nesting level.
|
|
79
|
+
#
|
|
80
|
+
# Args:
|
|
81
|
+
# cls: The class to which the JSON schema belongs
|
|
82
|
+
# json_schema: The original JSON schema
|
|
83
|
+
# option_field_path: List of option field names representing the path to the target subschema
|
|
84
|
+
# properties: List of property names to make optional within the subschema
|
|
85
|
+
# new_option_field: Name of the new boolean field that controls visibility
|
|
86
|
+
#
|
|
87
|
+
# Returns:
|
|
88
|
+
# Modified JSON schema with nested optional properties
|
|
89
|
+
# """
|
|
90
|
+
#
|
|
91
|
+
# # Find the target subschema by traversing the path
|
|
92
|
+
# def find_subschema(schema, path, current_depth=0):
|
|
93
|
+
# if current_depth >= len(path):
|
|
94
|
+
# return schema
|
|
95
|
+
#
|
|
96
|
+
# current_field = path[current_depth]
|
|
97
|
+
#
|
|
98
|
+
# if "dependencies" not in schema or current_field not in schema["dependencies"]:
|
|
99
|
+
# raise ValueError(f"Option field '{current_field}' not found in dependencies at depth {current_depth}")
|
|
100
|
+
#
|
|
101
|
+
# dependency = schema["dependencies"][current_field]
|
|
102
|
+
# if "oneOf" not in dependency or len(dependency["oneOf"]) < 2:
|
|
103
|
+
# raise ValueError(f"Invalid dependency structure for '{current_field}' at depth {current_depth}")
|
|
104
|
+
#
|
|
105
|
+
# # The subschema is the second element in the oneOf array (index 1)
|
|
106
|
+
# subschema = dependency["oneOf"][1]
|
|
107
|
+
#
|
|
108
|
+
# # Continue traversing
|
|
109
|
+
# return find_subschema(subschema, path, current_depth + 1)
|
|
110
|
+
#
|
|
111
|
+
# # Find the target subschema
|
|
112
|
+
# target_schema = find_subschema(json_schema, option_field_path)
|
|
113
|
+
#
|
|
114
|
+
# # Add the new option field to the target schema
|
|
115
|
+
# target_schema["properties"][new_option_field] = {
|
|
116
|
+
# "type": "boolean",
|
|
117
|
+
# "title": new_option_field,
|
|
118
|
+
# "default": False
|
|
119
|
+
# }
|
|
120
|
+
#
|
|
121
|
+
# # Move specified properties to a new dependency within the target schema
|
|
122
|
+
# new_props = {}
|
|
123
|
+
# for prop in properties:
|
|
124
|
+
# if prop not in target_schema["properties"]:
|
|
125
|
+
# raise ValueError(f"Property '{prop}' is not in the target schema")
|
|
126
|
+
# new_props[prop] = target_schema["properties"][prop]
|
|
127
|
+
# del target_schema["properties"][prop]
|
|
128
|
+
#
|
|
129
|
+
# # Create dependencies in the target schema if it doesn't exist
|
|
130
|
+
# if "dependencies" not in target_schema:
|
|
131
|
+
# target_schema["dependencies"] = {}
|
|
132
|
+
#
|
|
133
|
+
# # Add nested dependency
|
|
134
|
+
# nested_sub_schema = {
|
|
135
|
+
# "properties": {
|
|
136
|
+
# new_option_field: {"enum": [True]},
|
|
137
|
+
# **new_props
|
|
138
|
+
# }
|
|
139
|
+
# }
|
|
140
|
+
#
|
|
141
|
+
# target_schema["dependencies"][new_option_field] = {
|
|
142
|
+
# "oneOf": [
|
|
143
|
+
# {
|
|
144
|
+
# "properties": {
|
|
145
|
+
# new_option_field: {"enum": [False]},
|
|
146
|
+
# **{prop: {"type": "null"} for prop in properties}
|
|
147
|
+
# }
|
|
148
|
+
# },
|
|
149
|
+
# nested_sub_schema
|
|
150
|
+
# ]
|
|
151
|
+
# }
|
|
152
|
+
#
|
|
153
|
+
# # The changes are made directly to the target schema which is a reference
|
|
154
|
+
# # to part of json_schema, so we don't need to explicitly update json_schema
|
|
155
|
+
# return json_schema
|
|
156
|
+
#
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def ui_make_title(cls, ui_schema: Dict[str, Any], field: str, title: str) -> dict:
|
|
160
|
+
"""
|
|
161
|
+
Adds a title to the JSON schema.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
cls: The class to which the JSON schema belongs
|
|
165
|
+
ui_schema: The original ui_schema schema
|
|
166
|
+
title: Title to be added
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Modified JSON schema with title
|
|
170
|
+
"""
|
|
171
|
+
ui_schema[field] = {"ui:title": title}
|
|
172
|
+
return ui_schema
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def ui_make_foldable(ui_schema: Dict[str, Any], field: str) -> dict:
|
|
176
|
+
"""
|
|
177
|
+
Adds a foldable section to the JSON schema.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
field: The field to be made foldable
|
|
181
|
+
ui_schema: The original ui_schema schema
|
|
182
|
+
Returns:
|
|
183
|
+
Modified ui_schema with foldable section
|
|
184
|
+
|
|
185
|
+
"""
|
|
186
|
+
# TODO add checks that the fields actually exist
|
|
187
|
+
if field not in ui_schema:
|
|
188
|
+
ui_schema[field] = {}
|
|
189
|
+
if "ui:options" not in ui_schema:
|
|
190
|
+
ui_schema[field]["ui:options"] = {}
|
|
191
|
+
ui_schema[field]["ui:options"] = {
|
|
192
|
+
"ui:foldable": "true",
|
|
193
|
+
}
|
|
194
|
+
return ui_schema
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def ui_line_vector(ui_schema: Dict[str, Any], field: str) -> Dict[str, Any]:
|
|
198
|
+
"""
|
|
199
|
+
Modifies the JSON schema to represent a line vector.
|
|
200
|
+
|
|
201
|
+
Args:
|
|
202
|
+
ui_schema: The original JSON schema
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
Modified JSON schema with line vector representation
|
|
206
|
+
"""
|
|
207
|
+
# TODO add checks that the fields actually exist and is a list
|
|
208
|
+
if field not in ui_schema:
|
|
209
|
+
ui_schema[field] = {}
|
|
210
|
+
if "ui:options" not in ui_schema:
|
|
211
|
+
ui_schema[field]["ui:options"] = {}
|
|
212
|
+
ui_schema[field]["ui:options"]["ui:field"] = "LineVector"
|
|
213
|
+
return ui_schema
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simstack
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: A python based workflow engineering platform with a react-js UI
|
|
5
|
+
Author-email: Wolfgang Wenzel <wolfgang.wenzel@kit.edu>, Artem Buildin <artem.buildin@kit.edu>, Nikita Mitagin <nikita.mitagin@kit.edu>, Phillip Dullinger <phillip.dullinger@kit.edu>, Celso Rego <celso.rego@kit.edu>, Oliver Pettkau <oliver.pettkau@kit.edu>, Timo Strunk <timo.strunk@nanomatch.de>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.kit.edu/kit/ag_wenzel/simstack-model/
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: odmantic<2,>=1.0.2
|
|
12
|
+
Requires-Dist: cloudpickle<4,>=3.1.1
|
|
13
|
+
Requires-Dist: coolname<3,>=2.2.0
|
|
14
|
+
Requires-Dist: nest-asyncio<2,>=1.6.0
|
|
15
|
+
Requires-Dist: numpy>=2.3.0
|
|
16
|
+
Requires-Dist: pandas==2.3.2
|
|
17
|
+
Requires-Dist: pytest>=8.4.2
|
|
18
|
+
Requires-Dist: docutils>=0.22
|
|
19
|
+
Requires-Dist: pandas-stubs~=2.3.3
|
|
20
|
+
Requires-Dist: types-docutils~=0.22.3
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
## SimStack II Overview ⚡️
|
|
24
|
+
|
|
25
|
+
Simstack II is a workflow orchestration tool that lets you run your workflows on remote
|
|
26
|
+
resources.
|
|
27
|
+
|
|
28
|
+
This repo provides the base package for Simstack II development. To use the graphical user interface,
|
|
29
|
+
you need to install the
|
|
30
|
+
|
|
31
|
+
- [simstack-server](https://github.com/simstack/simstack-server) project, a python-based
|
|
32
|
+
fastapi app that connects to the Simstack II database. a
|
|
33
|
+
- [simstack-ui](https://github.com/simstack/simstack-ui) project, a react-js web frontend.
|
|
34
|
+
|
|
35
|
+
You can use the [simstack-example](https://github.com/simstack/simstack-example) project
|
|
36
|
+
to get started.
|
|
37
|
+
|
|
38
|
+
## Development workflow and versioning
|
|
39
|
+
|
|
40
|
+
This repository uses [Gitflow](https://nvie.com/posts/a-successful-git-branching-model/):
|
|
41
|
+
|
|
42
|
+
- `main` contains production releases.
|
|
43
|
+
- `develop` integrates changes for the next release.
|
|
44
|
+
- `feature-*`|`fix-*` branches start from and merge back into `develop`.
|
|
45
|
+
- `release-*` branches start from `develop`, then merge into both `develop` and `main`.
|
|
46
|
+
- `hotfix-*` branches start from `main`, then merge into both `main` and `develop`.
|
|
47
|
+
- each `main` merge commit must have a version tag.
|
|
48
|
+
|
|
49
|
+
Releases follow [Semantic Versioning 2.0.0](https://semver.org/) using
|
|
50
|
+
`MAJOR.MINOR.PATCH`: increment `MAJOR` for incompatible API changes, `MINOR` for
|
|
51
|
+
backward-compatible functionality, and `PATCH` for backward-compatible bug fixes.
|
|
52
|
+
|
|
53
|
+
### Setting the version
|
|
54
|
+
|
|
55
|
+
The package version is derived from Git tags by `setuptools-scm`, as configured in
|
|
56
|
+
`pyproject.toml`; it is not maintained in a source file. Do not edit the generated
|
|
57
|
+
`src/simstack/_version.py`.
|
|
58
|
+
|
|
59
|
+
After the release branch has been merged into `main`, create and push an annotated
|
|
60
|
+
semantic-version tag. Pushing it triggers the PyPI release workflow.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git switch main
|
|
64
|
+
git tag -a vX.Y.Z -m "Release vX.Y.Z"
|
|
65
|
+
git push origin vX.Y.Z
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Using SimStack II
|
|
70
|
+
|
|
71
|
+
### Setting Up a MongoDB Instance
|
|
72
|
+
|
|
73
|
+
SimStack II persists user data via MongoDB, so you need to have a running MongoDB instance.
|
|
74
|
+
|
|
75
|
+
In a minimal example, you can spin up a MongoDB instance on your local machine with Docker:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
docker run -d \
|
|
79
|
+
--name simstack-mongo \
|
|
80
|
+
-p 27017:27017 \
|
|
81
|
+
-e MONGO_INITDB_ROOT_USERNAME=admin \
|
|
82
|
+
-e MONGO_INITDB_ROOT_PASSWORD=yourpassword \
|
|
83
|
+
mongo:latest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This command:
|
|
87
|
+
|
|
88
|
+
- Runs MongoDB in detached mode (`-d`)
|
|
89
|
+
- Names the container `simstack-mongo`
|
|
90
|
+
- Maps port 27017 to your localhost
|
|
91
|
+
- Sets up basic authentication with username `admin` and password `yourpassword`
|
|
92
|
+
|
|
93
|
+
**Important**: Replace `yourpassword` with a secure password and update your `simstack.toml` connection string
|
|
94
|
+
accordingly:
|
|
95
|
+
|
|
96
|
+
```toml
|
|
97
|
+
connection_string = "mongodb://admin:yourpassword@localhost:27017/"
|
|
98
|
+
```
|
|
99
|
+
You can then create databases and collections in the MongoDB instance with the `mongo` CLI.
|
|
100
|
+
|
|
101
|
+
### Starting the SimStack II Server
|
|
102
|
+
|
|
103
|
+
Start the SimStack II server as described in the [simstack-server](https://github.com/simstack/simstack-server) repo.
|
|
104
|
+
Set the `CONNECTION_STRING` environment variable to the connection string for the administration
|
|
105
|
+
database you just created. You can check localhost:8000 to see if the server is running.
|
|
106
|
+
|
|
107
|
+
### Starting the SimStack II UI
|
|
108
|
+
|
|
109
|
+
Start the SimStack II UI as described in the [simstack-ui](https://github.com/simstack/simstack-ui) repo.
|
|
110
|
+
You should now be able to access the UI at http://localhost:3000.
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
| What you’ll do | Why it matters |
|
|
118
|
+
|-----------------------------------------|----------------------------------------------------|
|
|
119
|
+
| 1 Create a project specific environment | Keeps your system Python pristine |
|
|
120
|
+
| 2 Install simstack |
|
|
121
|
+
| 3 Clone relevant simstack base packages | Gives you ready-made tasks, sample data, and tests |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### Step 1 — Spin up the `simstack` environment 🐍
|
|
126
|
+
|
|
127
|
+
Choose your favorite Python **env manager**
|
|
128
|
+
|
|
129
|
+
The most modern managers are **pixi** for conda-style and **uv** for pip-style.
|
|
130
|
+
|
|
131
|
+
<details open>
|
|
132
|
+
<summary><strong>⬤ Recommended – Mamba (10× faster)</strong></summary>
|
|
133
|
+
|
|
134
|
+
Install **Mamba** if you don’t have it
|
|
135
|
+
See mamba [documentation](https://mamba.readthedocs.io/en/latest/) for Windows, Linux and macOS.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
mamba create -n simstack python=3.12 -y
|
|
139
|
+
mamba activate simstack
|
|
140
|
+
```
|
|
141
|
+
</details>
|
|
142
|
+
|
|
143
|
+
<details>
|
|
144
|
+
<summary><strong>⬤ micromamba – single-file binary</strong></summary>
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
micromamba create -n simstack python=3.12 -y
|
|
148
|
+
micromamba activate simstack
|
|
149
|
+
```
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary><strong>⬤ Classic conda</strong></summary>
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
conda create -n simstack python=3.12 -y
|
|
157
|
+
conda activate simstack
|
|
158
|
+
```
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
**Heads-up**: Simstack II works with Python ≥ 3.12 (CPython 64-bit).
|
|
162
|
+
Older versions (<3.12) may miss tomllib support and fail at runtime.
|
|
163
|
+
|
|
164
|
+
### Step 2 — Install simstack 📦
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# activate the (simstack) env
|
|
168
|
+
python -m pip install --upgrade pip
|
|
169
|
+
pip install simstack
|
|
170
|
+
|
|
171
|
+
Just type `tree` in the terminal, if the **installation** succeeds, you should see a directory structure like the folder tree shown below.
|
|
172
|
+
|
|
173
|
+
### Step 3 — Clone subrepos for existing simstack packages 📦
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# activate the (simstack) env
|
|
177
|
+
python -m pip install --upgrade pip
|
|
178
|
+
pip install simstack
|
|
179
|
+
|
|
180
|
+
Just type `tree` in the terminal, if the **installation** succeeds, you should see a directory structure like the folder tree shown below.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
### Step 2 — Install dependencies 📦
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# activate the (simstack) env
|
|
188
|
+
python -m pip install --upgrade pip
|
|
189
|
+
pip install simstack
|
|
190
|
+
|
|
191
|
+
Just type `tree` in the terminal, if the **installation** succeeds, you should see a directory structure like the folder tree shown below.
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
## 2. Configure Simstack II with `simstack.toml` ⚙️
|
|
198
|
+
|
|
199
|
+
Simstack II reads a single **TOML** file (`simstack.toml`) to learn
|
|
200
|
+
|
|
201
|
+
* which **resources** (local & remote) exist,
|
|
202
|
+
* how to reach your **MongoDB** backend,
|
|
203
|
+
* and where each host should place logs / artifacts.
|
|
204
|
+
|
|
205
|
+
> **Where should the file live?**
|
|
206
|
+
> Save it next in the folder simstack-model in both your local and HPC accounts.
|
|
207
|
+
> The CLI searches those paths automatically.
|
|
208
|
+
|
|
209
|
+
### 2.1 Minimal template
|
|
210
|
+
|
|
211
|
+
```toml
|
|
212
|
+
#######################################
|
|
213
|
+
# Global / shared parameters
|
|
214
|
+
#######################################
|
|
215
|
+
[parameters.common]
|
|
216
|
+
resources = ["local", "int-nano", "horeka", "justus", "self", "exchange", "uploads"]
|
|
217
|
+
database = "celso_data" # default DB
|
|
218
|
+
test_database = "celso_test_data" # used by `simstack selftest`
|
|
219
|
+
connection_string = "mongodb://<user>:<pass>@<host>:27017/" # ⬚ change!
|
|
220
|
+
|
|
221
|
+
#######################################
|
|
222
|
+
# Host-specific overrides
|
|
223
|
+
#######################################
|
|
224
|
+
# 1) Your own machine --------------------------------
|
|
225
|
+
[parameters.local]
|
|
226
|
+
ssh-key = "~/.ssh/id_rsa" # private key
|
|
227
|
+
resource = "local" # → maps to runners.local
|
|
228
|
+
workdir = "~/simstack/workflows" # absolute path
|
|
229
|
+
python_path = ["~/simstack/simstack-model",
|
|
230
|
+
"~/simstack/simstack-model/src"]
|
|
231
|
+
|
|
232
|
+
# 2) Remote upload node -----------------------------
|
|
233
|
+
[parameters.uploads]
|
|
234
|
+
ssh-key = "~/.ssh/id_rsa"
|
|
235
|
+
resource = "self"
|
|
236
|
+
workdir = "~/simstack/workflows"
|
|
237
|
+
python_path = ["~/simstack/simstack-model",
|
|
238
|
+
"~/simstack/simstack-model/src"]
|
|
239
|
+
|
|
240
|
+
# 3) Example HPC login node -------------------------
|
|
241
|
+
[parameters.int-nano]
|
|
242
|
+
ssh-key = "~/.ssh/id_rsa"
|
|
243
|
+
workdir = "/home/<user>/simstack"
|
|
244
|
+
python_path = ["/home/<user>/simstack/simstack-model",
|
|
245
|
+
"/home/<user>/simstack/simstack-model/src"]
|
|
246
|
+
environment_start = "mamba activate simstack" # run before each task
|
|
247
|
+
|
|
248
|
+
#######################################
|
|
249
|
+
# Internal web-server (rarely touched)
|
|
250
|
+
#######################################
|
|
251
|
+
[server]
|
|
252
|
+
port = 8000
|
|
253
|
+
SECRET_KEY = "<32-byte hex or env-var>" # ⬚ never commit real keys
|
|
254
|
+
upload_dir = "/srv/simstack/uploads" # Windows paths OK too
|
|
255
|
+
|
|
256
|
+
#######################################
|
|
257
|
+
# Canonical DNS names for hosts
|
|
258
|
+
#######################################
|
|
259
|
+
[hosts]
|
|
260
|
+
local = "localhost"
|
|
261
|
+
int-nano = "int-nano.int.kit.edu"
|
|
262
|
+
justus = "justus.int.kit.edu"
|
|
263
|
+
horeka = "horeka.int.kit.edu"
|
|
264
|
+
|
|
265
|
+
#######################################
|
|
266
|
+
# Directed data routes
|
|
267
|
+
#######################################
|
|
268
|
+
[[routes]]
|
|
269
|
+
source = "local" # where the artifact lives
|
|
270
|
+
target = "int-nano" # where you want it
|
|
271
|
+
host = "local" # node that **pushes** the data
|
|
272
|
+
|
|
273
|
+
[[routes]]
|
|
274
|
+
source = "int-nano"
|
|
275
|
+
target = "local"
|
|
276
|
+
host = "local"
|
|
277
|
+
|
|
278
|
+
# …repeat as needed
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## 3 Prepare *PYTHONPATH* locally & on every HPC account 📂
|
|
282
|
+
|
|
283
|
+
Add **both** the project root and its `src/` directory to `PYTHONPATH` so every Simstack II task can resolve imports no matter where it runs.
|
|
284
|
+
|
|
285
|
+
### 3.1 Create a helper script once (call it `set_pythonpath.sh`):
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
#!/usr/bin/env bash
|
|
289
|
+
# -----------------------------
|
|
290
|
+
# Adds the current repo + src/ to PYTHONPATH
|
|
291
|
+
# Call with: source set_pythonpath.sh
|
|
292
|
+
# -----------------------------
|
|
293
|
+
this_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
294
|
+
export PYTHONPATH="$this_dir:$this_dir/src${PYTHONPATH+:$PYTHONPATH}"
|
|
295
|
+
echo "PYTHONPATH = $PYTHONPATH"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 3.2 Make it executable & load it whenever you open a new shell:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
chmod +x set_pythonpath.sh # one-time
|
|
302
|
+
source /path/to/set_pythonpath.sh # every session, or add to ~/.bashrc
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### 3.3 Copy the script to each HPC account (e.g. int-nano, horeka, …):
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
scp set_pythonpath.sh user@int-nano.int.kit.edu:~/simstack/
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## 4. Ready, Set, Workflow! 🏁
|
|
312
|
+
|
|
313
|
+
**Mission**: prime Simstack II so your very first workflow launches without a hiccup—DB seeded, nodes known, runner humming.
|
|
314
|
+
|
|
315
|
+
### 🥇 Step 1 — Initialize the database
|
|
316
|
+
|
|
317
|
+
Simstack keeps its model and node catalogue in MongoDB. Populate (or refresh) the tables whenever you pull a new commit:
|
|
318
|
+
|
|
319
|
+
```python!
|
|
320
|
+
# from the repo root
|
|
321
|
+
cd src/simstack/utils # ⇢ utility scripts live here
|
|
322
|
+
python model_table.py # 🚀 inserts/updates the “Models” collection
|
|
323
|
+
python node_table.py # 🚀 inserts/updates the “Nodes” collection
|
|
324
|
+
```
|
|
325
|
+
### 🥈 Step 2 — Re‑register nodes (WaNos) 🔄
|
|
326
|
+
|
|
327
|
+
Any time you change a **node definition**—be it locally or on an HPC cluster—you must (re)announce it to the control plane:
|
|
328
|
+
|
|
329
|
+
```python!
|
|
330
|
+
# ▸ Local workstation
|
|
331
|
+
python src/simstack/core/node.py # instantaneous
|
|
332
|
+
|
|
333
|
+
# ▸ On int‑nano (or another cluster head node)
|
|
334
|
+
ssh user@int-nano.int.kit.edu
|
|
335
|
+
python ~/simstack/src/simstack/core/node.py
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Why **WaNos**? Workflow Aware Nodes—nodes that tell Simstack exactly what they’re capable of.
|
|
339
|
+
|
|
340
|
+
### 🥉 Step 3 — Fire up the runner on int‑nano 🚀
|
|
341
|
+
|
|
342
|
+
```python!
|
|
343
|
+
ssh user@int-nano.int.kit.edu # 1️⃣ log in
|
|
344
|
+
source ~/simstack/set_pythonpath.sh # 2️⃣ expose src/ to PYTHONPATH
|
|
345
|
+
python src/simstack/core/runner.py --resource int-nano # 3️⃣ start runner
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
You should see something like:
|
|
349
|
+
```bash!
|
|
350
|
+
2025-04-24 11:26:58 - ConfigReader - INFO - Initializing ConfigReader with resource: local on database celso_data
|
|
351
|
+
2025-04-24 11:26:58 - ConfigReader - INFO - workdir: /home/celso/Desktop/Project/KIT/simstack/Files/simstack_workflows
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
The runner now listens for jobs assigned to the int-nano resource and inherits the correct PYTHONPATH so your code imports flawlessly.
|
|
355
|
+
|
|
356
|
+
```bash!
|
|
357
|
+
[Runner‑int‑nano] ⚡️ connected to broker
|
|
358
|
+
[Runner‑int‑nano] 💤 waiting for tasks (Ctrl‑C to exit)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### 5. Hands‑On: binary_operations.py 🧮
|
|
362
|
+
|
|
363
|
+
Your environment is up, let's run a real Simstack workflow on your local machine.
|
|
364
|
+
|
|
365
|
+
### 5.1 What the code does
|
|
366
|
+
|
|
367
|
+
```python!
|
|
368
|
+
# simplified excerpt
|
|
369
|
+
a, b, c = 5, 10, 2 # sample inputs
|
|
370
|
+
add_result = a + b # → 15
|
|
371
|
+
multiply_result = add_result * c # → 30
|
|
372
|
+
print(multiply_result)
|
|
373
|
+
```
|
|
374
|
+
*Under the hood it uses the FloatData ODM model so the result is automatically stored in MongoDB with an ObjectId.*
|
|
375
|
+
|
|
376
|
+
### 5.2 Run it 🚀
|
|
377
|
+
|
|
378
|
+
```bash!
|
|
379
|
+
# stay inside your (simstack) env
|
|
380
|
+
cd simstack-model/examples # 1️⃣ go to examples directory
|
|
381
|
+
python binary_operations.py # 2️⃣ execute workflow script
|
|
382
|
+
```
|
|
383
|
+
Expected terminal output (the ObjectId will differ):
|
|
384
|
+
|
|
385
|
+
```bash!
|
|
386
|
+
id=ObjectId('680f3c149f39611649075d6a') value=30.0
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
🎉 **Congrats!** You’ve just:
|
|
390
|
+
|
|
391
|
+
**1.** Sent inputs through Simstack’s data‑model layer
|
|
392
|
+
|
|
393
|
+
**2.** Executed the adder ➜ multiplier chain
|
|
394
|
+
|
|
395
|
+
**3.** Persisted the final result in your configured MongoDB instance
|
|
396
|
+
|
|
397
|
+
Try changing the numbers in AddMultiplyInput(a, b, c) and re‑running to see different results. Feel free to explore other examples in the same folder or craft your own!
|
|
398
|
+
|
|
399
|
+
### 5.4 — Run *node_example.py* on **int-nano** via Slurm 🏎️💨
|
|
400
|
+
|
|
401
|
+
> **Mission:** Run `node_example.py` workflow in **int-nano** HPC cluster and let Simstack II generate & submit the Slurm job for you.
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
#### 🔑 Prerequisites
|
|
405
|
+
|
|
406
|
+
1. **Runner up & listening on int-nano**
|
|
407
|
+
```bash
|
|
408
|
+
# on the int-nano login node
|
|
409
|
+
ssh user@int-nano.int.kit.edu
|
|
410
|
+
source ~/simstack/set_pythonpath.sh # expose src/ to PYTHONPATH
|
|
411
|
+
python src/simstack/core/runner.py --resource int-nano
|
|
412
|
+
|
|
413
|
+
Leave this terminal open—your runner will watch the message broker for tasks targeting int-nano.
|
|
414
|
+
|
|
415
|
+
`node_example.py` available on your workstation (it lives in simstack-model/examples).
|
|
416
|
+
|
|
417
|
+
Slurm access on int-nano (the runner will create and submit the sbatch scripts for you).
|
|
418
|
+
|
|
419
|
+
### 🚀 Launch the workflow from your local machine
|
|
420
|
+
|
|
421
|
+
```python!
|
|
422
|
+
# still in (simstack) and inside simstack-model/examples on the local machine
|
|
423
|
+
python node_example.py
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
That single command does three things behind the scenes:
|
|
427
|
+
|
|
428
|
+
1. **Creates a task document** in MongoDB with resource="int-nano", queue="slurm".
|
|
429
|
+
|
|
430
|
+
2. **Signals the int-nano runner**, which in turn
|
|
431
|
+
|
|
432
|
+
* auto-generates an `id_num.err`, `id_num.out`, and `slurm_script.sh` file inside <workdir>/adder/ (see your simstack.toml)
|
|
433
|
+
* submits it with sbatch.
|
|
434
|
+
|
|
435
|
+
3. **Streams status** back to your local terminal until completion.
|
|
436
|
+
|
|
437
|
+
### 🖥️ Expected local console output
|
|
438
|
+
|
|
439
|
+
```bash!
|
|
440
|
+
task_id: 680f4ac265bb513834eeb92a created in read_db Task adder with 680f4ac265bb513834eeb92a is waiting for results
|
|
441
|
+
2025-04-28 11:30:47 - simstack.core.node - INFO - Task adder with task_id: 680f4ac265bb513834eeb92a completed remotely
|
|
442
|
+
2025-04-28 11:30:47 - simstack.core.node - INFO - Task adder with task_id: 680f4ac265bb513834eeb92a found with status TaskStatus.COMPLETED
|
|
443
|
+
2025-04-28 11:30:47 - simstack.core.node - INFO - Task adder with task_id: 680f4ac265bb513834eeb92a loaded outputs
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Once you see TaskStatus.COMPLETED, the Slurm job finished on int-nano and the result document was synced back to your MongoDB.
|
|
447
|
+
|
|
448
|
+
Now you’ve successfully:
|
|
449
|
+
|
|
450
|
+
* Spun up a remote runner on int-nano.
|
|
451
|
+
* Queued a Slurm job without writing a single sbatch file yourself.
|
|
452
|
+
* Retrieved the output transparently through Simstack II’s data layer.
|
|
453
|
+
|
|
454
|
+
Tweak the numbers in the script, re-run, and watch new adder.sbatch files—and fresh Slurm job-IDs—appear in your adder/ folder. Enjoy the speed-up! ⚡️
|