compox 2.0.0.dev2__tar.gz → 2.0.0.dev3__tar.gz
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.
- compox-2.0.0.dev3/PKG-INFO +151 -0
- compox-2.0.0.dev3/README.md +116 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/pyproject.toml +1 -1
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/root.py +4 -2
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/version.py +1 -1
- compox-2.0.0.dev2/PKG-INFO +0 -278
- compox-2.0.0.dev2/README.md +0 -243
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/LICENSE +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/NOTICE +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/THIRD_PARTY_LICENSES.txt +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/AlgorithmConfigSchema.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/AlgorithmDeployer.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/AlgorithmManager.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/BaseRunner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2AlignmentRunner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2EmbeddingRunner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2ImageRunner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2SegmentationRunner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Segmentation2SegmentationRunner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/deployment_utils.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/io_schemas.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/algorithm_utils/runner_context.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/cli.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/components/api_builder.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/components/celery_builder.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/components/db_connection_builder.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/components/minio_wrapper.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/components/server_builder.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/config/server_settings.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/database_connection/BaseConnection.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/database_connection/InMemoryConnection.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/database_connection/S3Connection.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/database_connection/TempfileConnection.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/database_connection/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/database_connection/database_utils.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/deploy_algorithms.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/internal/CUDAMemoryManager.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/internal/JobPOpen.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/internal/ServerSystrayInterface.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/internal/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/internal/downloader.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/internal/logging.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/pydantic_models.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/resources/compoxbackend.ico +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/algorithms_controller.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/execution_controller.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/execution_manager.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/file_controller.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/routers/file_controller_v1.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/run_server.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/run_worker.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/server_utils.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/session/DataCache.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/session/TaskSession.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/session/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/tasks/DebuggingTaskHandler.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/tasks/TaskHandler.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/tasks/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/tasks/celery_task.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/tasks/context_task_handler.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/src/compox/tasks/fastapi_background_task.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/.gitignore +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/Runner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/some_more_files/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/some_more_files/layer.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/some_more_files/layer2.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/utils.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/main.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/bar/pyproject.toml +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/dummy/README.md +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/dummy/Runner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/dummy/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/dummy/pyproject.toml +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/Runner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/some_more_files/__init__.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/some_more_files/layer.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/some_more_files/layer2.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/utils.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/main.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/algorithms/foo/pyproject.toml +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/conftest.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/pytest.ini +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_algorithm_deployer.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_base_runner.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_child_runners.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_datacache.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_delete_file.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_execute_algorithm.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_file_controller_v1.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_get_algorithm.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_get_all_algorithms.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_get_execution_record.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_get_file.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_post_file.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_runner_attribute_behavior.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_server.yaml +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_server_utils.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_stress.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_task_handler.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_task_session.py +0 -0
- {compox-2.0.0.dev2 → compox-2.0.0.dev3}/tests/test_utils.py +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: compox
|
|
3
|
+
Version: 2.0.0.dev3
|
|
4
|
+
Author-Email: Jan Matula <jan.matula@tescan.com>, =?utf-8?q?Old=C5=99ich_Kodym?= <oldrich.kodym@tescan.com>
|
|
5
|
+
License-Expression: Apache-2.0 AND LicenseRef-Commons-Clause-1.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
License-File: THIRD_PARTY_LICENSES.txt
|
|
9
|
+
Requires-Python: >=3.10.0
|
|
10
|
+
Requires-Dist: fastapi>=0.100.1
|
|
11
|
+
Requires-Dist: boto3>=1.36.0
|
|
12
|
+
Requires-Dist: celery==5.3.1
|
|
13
|
+
Requires-Dist: uvicorn>=0.25.0
|
|
14
|
+
Requires-Dist: h5py>=3.9.0
|
|
15
|
+
Requires-Dist: numpy<2.0.0
|
|
16
|
+
Requires-Dist: natsort==8.4.0
|
|
17
|
+
Requires-Dist: pytest>=7.4.2
|
|
18
|
+
Requires-Dist: pydantic-settings>=2.0.3
|
|
19
|
+
Requires-Dist: python-minifier>=2.9.0
|
|
20
|
+
Requires-Dist: pystray>=0.19.5
|
|
21
|
+
Requires-Dist: pywin32>=306; platform_system == "Windows"
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
23
|
+
Requires-Dist: toml>=0.10.2
|
|
24
|
+
Requires-Dist: flower>=2.0.1
|
|
25
|
+
Requires-Dist: python-multipart>=0.0.20
|
|
26
|
+
Requires-Dist: mangum>=0.19.0
|
|
27
|
+
Requires-Dist: requests==2.32.3
|
|
28
|
+
Requires-Dist: pycurl>=7.45.4
|
|
29
|
+
Requires-Dist: loguru>=0.7.3
|
|
30
|
+
Requires-Dist: typer>=0.16.0
|
|
31
|
+
Requires-Dist: pip>=25.2
|
|
32
|
+
Requires-Dist: build>=1.3.0
|
|
33
|
+
Requires-Dist: pdm-backend>=2.4.5
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# Compox
|
|
37
|
+
Compox is a simple Python execution engine for Tescan applications. It's purpose is to run data processing algorithms written in Python on the server and report the results to the client application such as Tescan 3D Viewer or Picannto.
|
|
38
|
+
## Installation
|
|
39
|
+
Compox can be installed through PyPI:
|
|
40
|
+
```bash
|
|
41
|
+
pip install compox
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can also install the server by cloning this repository and installing it from source.
|
|
45
|
+
|
|
46
|
+
Note that some additional dependencies, such as MinIO executable for your operating system, will be downloaded on the first run of the server.
|
|
47
|
+
|
|
48
|
+
## Running the server
|
|
49
|
+
Once installed into your Python environment, Compox can be run using the `compox` command. This command is available in the virtual environment
|
|
50
|
+
created during the setup process. Run the following command to list the available commands:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
compox --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
It's recommended to start with generating an initial configuration file with `compox generate-config`. See the configuration options section below.
|
|
57
|
+
To see the usage of the `generate-config` command, you can run:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
compox generate-config --help
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
To run the Compox, use the following command:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
compox run --config /path/to/config.yaml
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Deploying algorithms
|
|
70
|
+
See Algorithm development tutorial for information about target structure of the deployable algorithms.
|
|
71
|
+
|
|
72
|
+
Once your algorithm is ready, you can use the `compox deploy-algorithms` command to deploy it to your server.
|
|
73
|
+
To see the usage of the `deploy-algorithms` command, you can run:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
compox deploy-algorithms --help
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This command will read the algorithm definitions from the folder specified in your configuration file with the `deploy_algorithms_from` key
|
|
80
|
+
and deploy them to the server. For example:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
compox deploy-algorithms --config /path/to/config.yaml
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Note that the server does not need to be running in order to deploy the algorithms.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Configuration
|
|
90
|
+
The server uses pydantic settings for configuration. The options can be either set as runtime arguments, in a yaml file, or using the `COMPOX__` environment variables, in corresponding order of precedence.
|
|
91
|
+
|
|
92
|
+
- Ensure all paths and URLs are correctly set before running the application.
|
|
93
|
+
- Adjust CUDA settings based on hardware capabilities.
|
|
94
|
+
- Logging paths should be accessible by the application to prevent errors.
|
|
95
|
+
- See the [configuration reference](#configuration-reference) below for detailed configuration options.
|
|
96
|
+
|
|
97
|
+
<details><summary>Configuration reference</summary>
|
|
98
|
+
|
|
99
|
+
<br>
|
|
100
|
+
|
|
101
|
+
### Compox Configuration Reference
|
|
102
|
+
|
|
103
|
+
| Section | Field | Default | Description |
|
|
104
|
+
|----------------------------------|-----------------------------|------------------------------------|-----------------------------------------------------------------------------|
|
|
105
|
+
| | `port` | `5461` | The main server port used to make requests |
|
|
106
|
+
| | `deploy_algorithms_from` | `"./algorithms"` | Directory for algorithm deployment sources. |
|
|
107
|
+
| | `log_path` | `"LOG_DEFAULT:compox.log"` | Path to the main log file (supports dynamic prefixes). |
|
|
108
|
+
| | `config` | `None` | Optional config path override. |
|
|
109
|
+
| `info` | `product_name` | `"TESCAN 3D Backend"` | Product display name. |
|
|
110
|
+
| `info` | `server_tags` | `[]` → auto appends `"compox"` | Tags attached to the server. `"compox"` is added automatically. |
|
|
111
|
+
| `info` | `group_name` | `"TESCAN GROUP, a.s."` | Name of the corporate group. |
|
|
112
|
+
| `info` | `organization_name` | `"TESCAN 3DIM, s.r.o."` | Full name of the organization. |
|
|
113
|
+
| `info` | `organization_domain` | `"tescan3dim.com"` | Domain used in server configuration. |
|
|
114
|
+
| `gui` | `algorithm_add_remove_in_menus` | `False` | Enables/disables GUI menu for algorithm management. |
|
|
115
|
+
| `gui` | `use_systray` | `False` | Enables/disables systray GUI integration. |
|
|
116
|
+
| `gui` | `icon_path` | Path to the installed package resource | Path to the systray icon (supports dynamic prefixes) |
|
|
117
|
+
| `inference` | `device` | `"cuda"` | Device used for model inference (`"cpu"`, `"cuda"`, `"mps"`). |
|
|
118
|
+
| `inference` | `cuda_visible_devices` | `"0"` | Comma-separated list of visible CUDA GPUs. |
|
|
119
|
+
| `storage` | `collection_prefix` | `""` | Prefix applied to object store collections. (useful for AWS s3 store, where unique bucket names are needed)|
|
|
120
|
+
| `storage` | `data_store_expire_days` | `1` | Number of days until stored datasets expire. |
|
|
121
|
+
| `storage` | `access_key_id` | generated with `UUIDv4` | Generated access key for storage backend. If `null` is provided, random UUIDv4 is generated. |
|
|
122
|
+
| `storage` | `secret_access_key` | generated with `UUIDv4` | Generated secret key for storage backend. If `null` is provided, random UUIDv4 is generated. |S
|
|
123
|
+
| `storage.backend_settings` (minio) | `provider` | `"minio"` | Selected backend provider. |
|
|
124
|
+
| `storage.backend_settings` (minio) | `start_instance` | `True` | Whether to start a local MinIO server. |
|
|
125
|
+
| `storage.backend_settings` (minio) | `port` | `9091` | MinIO service port. |
|
|
126
|
+
| `storage.backend_settings` (minio) | `console_port` | `9090` | MinIO admin console port. |
|
|
127
|
+
| `storage.backend_settings` (minio) | `executable_path` | `"minio/minio_bin"` | Path to the MinIO binary (accepts dynamic prefixes). |
|
|
128
|
+
| `storage.backend_settings` (minio) | `storage_path` | `"minio/compox_store"` | Storage directory used by MinIO (accepts dynamic prefixes). |
|
|
129
|
+
| `storage.backend_settings` (minio) | `aws_region` | `None` | Optional AWS compatibility region. |
|
|
130
|
+
| `storage.backend_settings` (minio) | `s3_domain_name` | `None` | Optional domain override for S3 compatibility. |
|
|
131
|
+
| `storage.backend_settings` (minio) | `s3_endpoint_url` | Derived from `port` | Computed as `http://localhost:{port}`. |
|
|
132
|
+
| `storage.backend_settings` (aws) | `provider` | `"aws"` | AWS backend selection. |
|
|
133
|
+
| `storage.backend_settings` (aws) | `s3_endpoint_url` | `None` | Optional override for S3 endpoint URL. |
|
|
134
|
+
| `storage.backend_settings` (aws) | `aws_region` | `None` | AWS region (e.g. `us-east-1`). |
|
|
135
|
+
| `storage.backend_settings` (aws) | `s3_domain_name` | `None` | Domain used for S3-style URLs. |
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
Some fields in the Compox configuration (such as `log_path`, `icon_path`, etc.) support **dynamic prefixes** that resolve to OS-specific or runtime-specific paths. This allows for portability across platforms (e.g., Windows, Linux) and between development and production environments.
|
|
139
|
+
|
|
140
|
+
#### Supported Prefixes
|
|
141
|
+
|
|
142
|
+
| Prefix | Meaning (Resolved To...) |
|
|
143
|
+
|--------------------------|------------------------------------------------------------------------------------------|
|
|
144
|
+
| `LOG_DEFAULT:` | A platform-dependent log directory: |
|
|
145
|
+
| | - Windows: `%TEMP%/<organization>/<product>` |
|
|
146
|
+
| | - Linux/macOS: `/var/log/<organization>/<product>` |
|
|
147
|
+
| `PROGRAMDATA_DEFAULT:` | A system-wide data directory (Windows only): |
|
|
148
|
+
| | - e.g., `%PROGRAMDATA%/<organization>/<product>` |
|
|
149
|
+
| | - On Linux/macOS, defaults to `"."` (current dir) |
|
|
150
|
+
|
|
151
|
+
These are resolved **at runtime** in the `Settings.parse_paths()` validator method.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Compox
|
|
2
|
+
Compox is a simple Python execution engine for Tescan applications. It's purpose is to run data processing algorithms written in Python on the server and report the results to the client application such as Tescan 3D Viewer or Picannto.
|
|
3
|
+
## Installation
|
|
4
|
+
Compox can be installed through PyPI:
|
|
5
|
+
```bash
|
|
6
|
+
pip install compox
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
You can also install the server by cloning this repository and installing it from source.
|
|
10
|
+
|
|
11
|
+
Note that some additional dependencies, such as MinIO executable for your operating system, will be downloaded on the first run of the server.
|
|
12
|
+
|
|
13
|
+
## Running the server
|
|
14
|
+
Once installed into your Python environment, Compox can be run using the `compox` command. This command is available in the virtual environment
|
|
15
|
+
created during the setup process. Run the following command to list the available commands:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
compox --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
It's recommended to start with generating an initial configuration file with `compox generate-config`. See the configuration options section below.
|
|
22
|
+
To see the usage of the `generate-config` command, you can run:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
compox generate-config --help
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To run the Compox, use the following command:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
compox run --config /path/to/config.yaml
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Deploying algorithms
|
|
35
|
+
See Algorithm development tutorial for information about target structure of the deployable algorithms.
|
|
36
|
+
|
|
37
|
+
Once your algorithm is ready, you can use the `compox deploy-algorithms` command to deploy it to your server.
|
|
38
|
+
To see the usage of the `deploy-algorithms` command, you can run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
compox deploy-algorithms --help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This command will read the algorithm definitions from the folder specified in your configuration file with the `deploy_algorithms_from` key
|
|
45
|
+
and deploy them to the server. For example:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
compox deploy-algorithms --config /path/to/config.yaml
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Note that the server does not need to be running in order to deploy the algorithms.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
The server uses pydantic settings for configuration. The options can be either set as runtime arguments, in a yaml file, or using the `COMPOX__` environment variables, in corresponding order of precedence.
|
|
56
|
+
|
|
57
|
+
- Ensure all paths and URLs are correctly set before running the application.
|
|
58
|
+
- Adjust CUDA settings based on hardware capabilities.
|
|
59
|
+
- Logging paths should be accessible by the application to prevent errors.
|
|
60
|
+
- See the [configuration reference](#configuration-reference) below for detailed configuration options.
|
|
61
|
+
|
|
62
|
+
<details><summary>Configuration reference</summary>
|
|
63
|
+
|
|
64
|
+
<br>
|
|
65
|
+
|
|
66
|
+
### Compox Configuration Reference
|
|
67
|
+
|
|
68
|
+
| Section | Field | Default | Description |
|
|
69
|
+
|----------------------------------|-----------------------------|------------------------------------|-----------------------------------------------------------------------------|
|
|
70
|
+
| | `port` | `5461` | The main server port used to make requests |
|
|
71
|
+
| | `deploy_algorithms_from` | `"./algorithms"` | Directory for algorithm deployment sources. |
|
|
72
|
+
| | `log_path` | `"LOG_DEFAULT:compox.log"` | Path to the main log file (supports dynamic prefixes). |
|
|
73
|
+
| | `config` | `None` | Optional config path override. |
|
|
74
|
+
| `info` | `product_name` | `"TESCAN 3D Backend"` | Product display name. |
|
|
75
|
+
| `info` | `server_tags` | `[]` → auto appends `"compox"` | Tags attached to the server. `"compox"` is added automatically. |
|
|
76
|
+
| `info` | `group_name` | `"TESCAN GROUP, a.s."` | Name of the corporate group. |
|
|
77
|
+
| `info` | `organization_name` | `"TESCAN 3DIM, s.r.o."` | Full name of the organization. |
|
|
78
|
+
| `info` | `organization_domain` | `"tescan3dim.com"` | Domain used in server configuration. |
|
|
79
|
+
| `gui` | `algorithm_add_remove_in_menus` | `False` | Enables/disables GUI menu for algorithm management. |
|
|
80
|
+
| `gui` | `use_systray` | `False` | Enables/disables systray GUI integration. |
|
|
81
|
+
| `gui` | `icon_path` | Path to the installed package resource | Path to the systray icon (supports dynamic prefixes) |
|
|
82
|
+
| `inference` | `device` | `"cuda"` | Device used for model inference (`"cpu"`, `"cuda"`, `"mps"`). |
|
|
83
|
+
| `inference` | `cuda_visible_devices` | `"0"` | Comma-separated list of visible CUDA GPUs. |
|
|
84
|
+
| `storage` | `collection_prefix` | `""` | Prefix applied to object store collections. (useful for AWS s3 store, where unique bucket names are needed)|
|
|
85
|
+
| `storage` | `data_store_expire_days` | `1` | Number of days until stored datasets expire. |
|
|
86
|
+
| `storage` | `access_key_id` | generated with `UUIDv4` | Generated access key for storage backend. If `null` is provided, random UUIDv4 is generated. |
|
|
87
|
+
| `storage` | `secret_access_key` | generated with `UUIDv4` | Generated secret key for storage backend. If `null` is provided, random UUIDv4 is generated. |S
|
|
88
|
+
| `storage.backend_settings` (minio) | `provider` | `"minio"` | Selected backend provider. |
|
|
89
|
+
| `storage.backend_settings` (minio) | `start_instance` | `True` | Whether to start a local MinIO server. |
|
|
90
|
+
| `storage.backend_settings` (minio) | `port` | `9091` | MinIO service port. |
|
|
91
|
+
| `storage.backend_settings` (minio) | `console_port` | `9090` | MinIO admin console port. |
|
|
92
|
+
| `storage.backend_settings` (minio) | `executable_path` | `"minio/minio_bin"` | Path to the MinIO binary (accepts dynamic prefixes). |
|
|
93
|
+
| `storage.backend_settings` (minio) | `storage_path` | `"minio/compox_store"` | Storage directory used by MinIO (accepts dynamic prefixes). |
|
|
94
|
+
| `storage.backend_settings` (minio) | `aws_region` | `None` | Optional AWS compatibility region. |
|
|
95
|
+
| `storage.backend_settings` (minio) | `s3_domain_name` | `None` | Optional domain override for S3 compatibility. |
|
|
96
|
+
| `storage.backend_settings` (minio) | `s3_endpoint_url` | Derived from `port` | Computed as `http://localhost:{port}`. |
|
|
97
|
+
| `storage.backend_settings` (aws) | `provider` | `"aws"` | AWS backend selection. |
|
|
98
|
+
| `storage.backend_settings` (aws) | `s3_endpoint_url` | `None` | Optional override for S3 endpoint URL. |
|
|
99
|
+
| `storage.backend_settings` (aws) | `aws_region` | `None` | AWS region (e.g. `us-east-1`). |
|
|
100
|
+
| `storage.backend_settings` (aws) | `s3_domain_name` | `None` | Domain used for S3-style URLs. |
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
Some fields in the Compox configuration (such as `log_path`, `icon_path`, etc.) support **dynamic prefixes** that resolve to OS-specific or runtime-specific paths. This allows for portability across platforms (e.g., Windows, Linux) and between development and production environments.
|
|
104
|
+
|
|
105
|
+
#### Supported Prefixes
|
|
106
|
+
|
|
107
|
+
| Prefix | Meaning (Resolved To...) |
|
|
108
|
+
|--------------------------|------------------------------------------------------------------------------------------|
|
|
109
|
+
| `LOG_DEFAULT:` | A platform-dependent log directory: |
|
|
110
|
+
| | - Windows: `%TEMP%/<organization>/<product>` |
|
|
111
|
+
| | - Linux/macOS: `/var/log/<organization>/<product>` |
|
|
112
|
+
| `PROGRAMDATA_DEFAULT:` | A system-wide data directory (Windows only): |
|
|
113
|
+
| | - e.g., `%PROGRAMDATA%/<organization>/<product>` |
|
|
114
|
+
| | - On Linux/macOS, defaults to `"."` (current dir) |
|
|
115
|
+
|
|
116
|
+
These are resolved **at runtime** in the `Settings.parse_paths()` validator method.
|
|
@@ -3,11 +3,13 @@ Copyright 2024 TESCAN 3DIM, s.r.o.
|
|
|
3
3
|
All rights reserved
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
+
import importlib.metadata
|
|
6
7
|
from fastapi import APIRouter, Request
|
|
7
8
|
from typing import Union
|
|
8
9
|
|
|
9
10
|
from compox.pydantic_models import RootMessage, ResponseMessage
|
|
10
11
|
from compox.server_utils import check_system_gpu_availability
|
|
12
|
+
import compox
|
|
11
13
|
|
|
12
14
|
router = APIRouter(prefix="", tags=["root"])
|
|
13
15
|
|
|
@@ -44,8 +46,8 @@ def read_root(request: Request) -> Union[RootMessage, ResponseMessage]:
|
|
|
44
46
|
group = settings.info.group_name
|
|
45
47
|
organization = settings.info.organization_name
|
|
46
48
|
domain = settings.info.organization_domain
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
version = importlib.metadata.version('compox')
|
|
49
51
|
cuda_available, cuda_capable_device_count = (
|
|
50
52
|
check_system_gpu_availability()
|
|
51
53
|
)
|
compox-2.0.0.dev2/PKG-INFO
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: compox
|
|
3
|
-
Version: 2.0.0.dev2
|
|
4
|
-
Author-Email: Jan Matula <jan.matula@tescan.com>, =?utf-8?q?Old=C5=99ich_Kodym?= <oldrich.kodym@tescan.com>
|
|
5
|
-
License-Expression: Apache-2.0 AND LicenseRef-Commons-Clause-1.0
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
License-File: NOTICE
|
|
8
|
-
License-File: THIRD_PARTY_LICENSES.txt
|
|
9
|
-
Requires-Python: >=3.10.0
|
|
10
|
-
Requires-Dist: fastapi>=0.100.1
|
|
11
|
-
Requires-Dist: boto3>=1.36.0
|
|
12
|
-
Requires-Dist: celery==5.3.1
|
|
13
|
-
Requires-Dist: uvicorn>=0.25.0
|
|
14
|
-
Requires-Dist: h5py>=3.9.0
|
|
15
|
-
Requires-Dist: numpy<2.0.0
|
|
16
|
-
Requires-Dist: natsort==8.4.0
|
|
17
|
-
Requires-Dist: pytest>=7.4.2
|
|
18
|
-
Requires-Dist: pydantic-settings>=2.0.3
|
|
19
|
-
Requires-Dist: python-minifier>=2.9.0
|
|
20
|
-
Requires-Dist: pystray>=0.19.5
|
|
21
|
-
Requires-Dist: pywin32>=306; platform_system == "Windows"
|
|
22
|
-
Requires-Dist: pyyaml>=6.0.2
|
|
23
|
-
Requires-Dist: toml>=0.10.2
|
|
24
|
-
Requires-Dist: flower>=2.0.1
|
|
25
|
-
Requires-Dist: python-multipart>=0.0.20
|
|
26
|
-
Requires-Dist: mangum>=0.19.0
|
|
27
|
-
Requires-Dist: requests==2.32.3
|
|
28
|
-
Requires-Dist: pycurl>=7.45.4
|
|
29
|
-
Requires-Dist: loguru>=0.7.3
|
|
30
|
-
Requires-Dist: typer>=0.16.0
|
|
31
|
-
Requires-Dist: pip>=25.2
|
|
32
|
-
Requires-Dist: build>=1.3.0
|
|
33
|
-
Requires-Dist: pdm-backend>=2.4.5
|
|
34
|
-
Description-Content-Type: text/markdown
|
|
35
|
-
|
|
36
|
-
# Compox
|
|
37
|
-
Compox is a simple Python execution engine based on FastAPI with a MinIO object storage and Celery task queue. The app is designed to run algorithms written in Python on the server and report the results to the user.
|
|
38
|
-
## Installation
|
|
39
|
-
Compox can be installed through PyPI:
|
|
40
|
-
```bash
|
|
41
|
-
pip install compox
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
You can also install the server by cloning this repository and installing it from source.
|
|
45
|
-
|
|
46
|
-
Note that some additional dependencies, such as MinIO executable for your operating system, will be downloaded on the first run of the server.
|
|
47
|
-
|
|
48
|
-
## Running the server
|
|
49
|
-
Once installed into your Python environment, it's recommended to generate an initial configuration file with `compox generate-config`.
|
|
50
|
-
To see the available options for the `generate-config` command, you can run:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
compox generate-config --help
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The Compox can be run using the `compox` command. This command is available in the virtual environment created during the setup process. Run the following command to list the available commands:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
compox --help
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
To run the Compox, use the following command:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
compox run --config /path/to/config.yaml
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Deploying algorithms
|
|
69
|
-
A future release of this package will include a detailed tutorial on how to prepare a data processing algorithm for T3D applications.
|
|
70
|
-
|
|
71
|
-
Once your algorithm is ready, you can use the `compox deploy-algorithms` command to deploy it to your server. This command will read the algorithm definitions from the specified configuration file and deploy them to the server. For example:
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
compox deploy-algorithms --config /path/to/config.yaml
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
To see the available options for the `deploy-algorithms` command, you can run:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
compox deploy-algorithms --help
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Configuration
|
|
84
|
-
The server uses pydantic settings for configuration. The configuration can be either set in a yaml file or as arguments when running the server.
|
|
85
|
-
|
|
86
|
-
- Ensure all paths and URLs are correctly set before running the application.
|
|
87
|
-
- Adjust CUDA settings based on hardware capabilities.
|
|
88
|
-
- Logging paths should be accessible by the application to prevent errors.
|
|
89
|
-
- MinIO settings must align with whether it is run locally or through an external S3 service.
|
|
90
|
-
- See the [configuration reference](#configuration-reference) below for detailed configuration options.
|
|
91
|
-
|
|
92
|
-
<details><summary>Configuration reference</summary>
|
|
93
|
-
|
|
94
|
-
<br>
|
|
95
|
-
|
|
96
|
-
### Compox Configuration Reference
|
|
97
|
-
|
|
98
|
-
| Section | Field | Default | Description |
|
|
99
|
-
|----------------------------------|-----------------------------|------------------------------------|-----------------------------------------------------------------------------|
|
|
100
|
-
| | `port` | `5461` | The main server port used to make requests |
|
|
101
|
-
| | `deploy_algorithms_from` | `"./algorithms"` | Directory for algorithm deployment sources. |
|
|
102
|
-
| | `log_path` | `"LOG_DEFAULT:compox.log"` | Path to the main log file (supports dynamic prefixes). |
|
|
103
|
-
| | `config` | `None` | Optional config path override. |
|
|
104
|
-
| `info` | `product_name` | `"TESCAN 3D Backend"` | Product display name. |
|
|
105
|
-
| `info` | `server_tags` | `[]` → auto appends `"compox"` | Tags attached to the server. `"compox"` is added automatically. |
|
|
106
|
-
| `info` | `group_name` | `"TESCAN GROUP, a.s."` | Name of the corporate group. |
|
|
107
|
-
| `info` | `organization_name` | `"TESCAN 3DIM, s.r.o."` | Full name of the organization. |
|
|
108
|
-
| `info` | `organization_domain` | `"tescan3dim.com"` | Domain used in server configuration. |
|
|
109
|
-
| `info` | `version` | `"0.1"` | Semantic version of the server release. |
|
|
110
|
-
| `gui` | `algorithm_add_remove_in_menus` | `False` | Enables/disables GUI menu for algorithm management. |
|
|
111
|
-
| `gui` | `use_systray` | `False` | Enables/disables systray GUI integration. |
|
|
112
|
-
| `gui` | `icon_path` | `"../compox/resources/compoxbackend.ico"` | Path to the systray icon (supports dynamic prefixes) |
|
|
113
|
-
| `storage` | `collection_prefix` | `""` | Prefix applied to object store collections. (useful for AWS s3 store, where unique bucket names are needed)|
|
|
114
|
-
| `storage` | `data_store_expire_days` | `1` | Number of days until stored datasets expire. |
|
|
115
|
-
| `storage` | `access_key_id` | `UUIDv4` | Generated access key for storage backend. If `null` is provided, random UUIDv4 is generated. |
|
|
116
|
-
| `storage` | `secret_access_key` | `UUIDv4` | Generated secret key for storage backend. If `null` is provided, random UUIDv4 is generated. |S
|
|
117
|
-
| `storage.backend_settings` (minio) | `provider` | `"minio"` | Selected backend provider. |
|
|
118
|
-
| `storage.backend_settings` (minio) | `start_instance` | `True` | Whether to start a local MinIO server. |
|
|
119
|
-
| `storage.backend_settings` (minio) | `port` | `9091` | MinIO service port. |
|
|
120
|
-
| `storage.backend_settings` (minio) | `console_port` | `9090` | MinIO admin console port. |
|
|
121
|
-
| `storage.backend_settings` (minio) | `executable_path` | `"minio/minio_bin"` | Path to the MinIO binary (accepts dynamic prefixes). |
|
|
122
|
-
| `storage.backend_settings` (minio) | `storage_path` | `"minio/compox_store"` | Storage directory used by MinIO (accepts dynamic prefixes). |
|
|
123
|
-
| `storage.backend_settings` (minio) | `aws_region` | `None` | Optional AWS compatibility region. |
|
|
124
|
-
| `storage.backend_settings` (minio) | `s3_domain_name` | `None` | Optional domain override for S3 compatibility. |
|
|
125
|
-
| `storage.backend_settings` (minio) | `s3_endpoint_url` | Derived from `port` | Computed as `http://localhost:{port}`. |
|
|
126
|
-
| `storage.backend_settings` (aws) | `provider` | `"aws"` | AWS backend selection. |
|
|
127
|
-
| `storage.backend_settings` (aws) | `s3_endpoint_url` | `None` | Optional override for S3 endpoint URL. |
|
|
128
|
-
| `storage.backend_settings` (aws) | `aws_region` | `None` | AWS region (e.g. `us-east-1`). |
|
|
129
|
-
| `storage.backend_settings` (aws) | `s3_domain_name` | `None` | Domain used for S3-style URLs. |
|
|
130
|
-
| `inference` | `device` | `"cuda"` | Device used for model inference (`"cpu"`, `"cuda"`, `"mps"`). |
|
|
131
|
-
| `inference` | `cuda_visible_devices` | `"0"` | Comma-separated list of visible CUDA GPUs. |
|
|
132
|
-
| `inference.backend_settings` (fastapi) | `executor` | `"fastapi_background_tasks"` | Task executor type. |
|
|
133
|
-
| `inference.backend_settings` (fastapi) | `worker_number` | `1` | Number of worker threads for FastAPI tasks. |
|
|
134
|
-
| `inference.backend_settings` (celery) | `executor` | `"celery"` | Task executor type. |
|
|
135
|
-
| `inference.backend_settings` (celery) | `worker_name` | `"compox_worker"` | Name of the Celery worker. |
|
|
136
|
-
| `inference.backend_settings` (celery) | `broker_url` | **Required** | URL of the message broker (e.g. `amqp://`, `redis://`). |
|
|
137
|
-
| `inference.backend_settings` (celery) | `result_backend` | `"rpc://"` | Backend used to store task results. |
|
|
138
|
-
| `inference.backend_settings` (celery) | `run_flower` | `False` | Whether to start a Flower dashboard. |
|
|
139
|
-
| `inference.backend_settings` (celery) | `flower_port` | `None` | Port for Flower UI (if `run_flower` is True). |
|
|
140
|
-
| `ssl` | `use_ssl` | `False` | Enables HTTPS if True. |
|
|
141
|
-
| `ssl` | `ssl_keyfile` | `None` | Optional path to the SSL key file (accepts dynamic prefixes). |
|
|
142
|
-
| `ssl` | `ssl_certfile` | `None` | Optional path to the SSL certificate file (accepts dynamic prefixes). |
|
|
143
|
-
| `middleware` | `allow_origins` | `[]` | List of allowed CORS origins. |
|
|
144
|
-
| `middleware` | `allow_methods` | `["GET"]` | HTTP methods permitted in CORS. |
|
|
145
|
-
| `middleware` | `allow_headers` | `[]` | Custom headers permitted in CORS. |
|
|
146
|
-
| `middleware` | `allow_credentials` | `False` | Whether to allow credentials in CORS. |
|
|
147
|
-
| `middleware` | `expose_headers` | `[]` | Headers exposed to browsers. |
|
|
148
|
-
| `middleware` | `max_age` | `3600` | Cache time (in seconds) for CORS preflight. |
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Some fields in the Compox configuration (such as `log_path`, `icon_path`, `ssl_keyfile`, etc.) support **dynamic prefixes** that resolve to OS-specific or runtime-specific paths. This allows for portability across platforms (e.g., Windows, Linux) and between development and production environments.
|
|
152
|
-
|
|
153
|
-
#### Supported Prefixes
|
|
154
|
-
|
|
155
|
-
| Prefix | Meaning (Resolved To...) |
|
|
156
|
-
|--------------------------|------------------------------------------------------------------------------------------|
|
|
157
|
-
| `LOG_DEFAULT:` | A platform-dependent log directory: |
|
|
158
|
-
| | - Windows: `%TEMP%/<organization>/<product>` |
|
|
159
|
-
| | - Linux/macOS: `/var/log/<organization>/<product>` |
|
|
160
|
-
| `PROGRAMDATA_DEFAULT:` | A system-wide data directory (Windows only): |
|
|
161
|
-
| | - e.g., `%PROGRAMDATA%/<organization>/<product>` |
|
|
162
|
-
| | - On Linux/macOS, defaults to `"."` (current dir) |
|
|
163
|
-
| `RELATIVE_DEFAULT:` | A relative path to the current executable (PyInstaller compatible): |
|
|
164
|
-
| | - If bundled: `sys._MEIPASS/<path>` |
|
|
165
|
-
| | - Otherwise: `"./<path>"` |
|
|
166
|
-
|
|
167
|
-
> These are resolved **at runtime** in the `Settings.parse_paths()` validator method.
|
|
168
|
-
|
|
169
|
-
#### Example
|
|
170
|
-
|
|
171
|
-
```yaml
|
|
172
|
-
log_path: "LOG_DEFAULT:compox.log"
|
|
173
|
-
ssl:
|
|
174
|
-
use_ssl: true
|
|
175
|
-
ssl_keyfile: "PROGRAMDATA_DEFAULT:ssl/server.key"
|
|
176
|
-
ssl_certfile: "PROGRAMDATA_DEFAULT:ssl/server.crt"
|
|
177
|
-
gui:
|
|
178
|
-
icon_path: "RELATIVE_DEFAULT:resources/icon.ico"
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Server Execution and Tooling
|
|
182
|
-
|
|
183
|
-
Compox can be run using the `compox` command. This command is available in the virtual environment created during the setup process. Run the following command to list the available commands:
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
compox --help
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Running the Server
|
|
190
|
-
To run the Compox, use the following command:
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
compox run --config config.yaml
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Replace `config.yaml` with the path to your configuration file. The server will start and listen on the port specified in the configuration.
|
|
197
|
-
You can also specify the configuration file directly in the command line, which will override the default configs and the configuarion field in the config file. Nested configuration fields can be specified using dot notation. For example, to set the executor to `celery` and the worker name to `my_worker`, you can run:
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
compox run --config config.yaml --inference.backend_settings.executor celery --inference.backend_settings.worker_name my_worker
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
To see the available options for the `run` command, you can run:
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
compox run --help
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Worker spawning (for Celery)
|
|
210
|
-
To spawn a Celery worker, you can use the `compox spawn-worker` command. This command will start a Celery worker with the specified configuration. You can specify the worker name and other settings as needed. For example:
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
compox spawn-worker --config config.yaml --inference.backend_settings.worker_name my_worker
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
To see the available options for the `spawn-worker` command, you can run:
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
compox spawn-worker --help
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Running tests
|
|
223
|
-
To run the tests, you can use the `compox test` command. This command will run the tests defined in the `tests` directory. You should provide the path to the folder containing the tests (`--test-path`), which is `tests` by default. You can either provide a path to a specific configuration file (`--config`), which will spawn a server instance and run the tests against it, or you can run the tests against a running server instance by providing the `--server-url` argument. For example:
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
compox test --test-path tests --config config.yaml
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
To see the available options for the `test` command, you can run:
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
compox test --help
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Deploy algorithms
|
|
236
|
-
To deploy algorithms to the server, you can use the `compox deploy-algorithms` command. This command will read the algorithm definitions from the specified configuration file and deploy them to the server. For example:
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
compox deploy-algorithms --config app_server.yaml
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
To see the available options for the `deploy-algorithms` command, you can run:
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
compox deploy-algorithms --help
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Generate configuration
|
|
249
|
-
If you don't have a configuration file, you can generate a default configuration file using the `compox generate-config` command. This command will create a default configuration file in the specified path. You can also override the default fields in the configuration file by providing them as command line arguments. You will be prompted if you try to generate a configuration file that already exists. For example:
|
|
250
|
-
|
|
251
|
-
```bash
|
|
252
|
-
compox generate-config --path app_server.yaml --port 8888 --gui.use_systray True
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
To see the available options for the `generate-config` command, you can run:
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
compox generate-config --help
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Serving documentation
|
|
262
|
-
You can update documentation by navigating to the `python-computing-backend/compox/docs` directory and running the following command:
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
make.bat html
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
This will generate the documentation in the `_build/html` directory. After the documentation is built, you can serve it using the `compox serve-docs` command. This command will start a simple HTTP server to serve the documentation files. You can specify the directory where the documentation is located and the port on which to serve it. For example:
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
compox serve-docs --directory docs/_build/html --port 8000
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
To see the available options for the `serve-docs` command, you can run:
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
compox serve-docs --help
|
|
278
|
-
```
|