Skip to content

Commit 23206ff

Browse files
committed
Added a SETUP.md guide for adjustable settings as well as fixes for test settings.
1 parent 57f3e00 commit 23206ff

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

SETUP.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Setting Up the Environment
2+
3+
---
4+
5+
To set up the environment for TokenGate, follow the steps below:
6+
7+
1. Clone or download the repository to your local machine.
8+
2. Ensure you have Python 3.12 installed on your system.
9+
10+
*Check your Python version by running:*
11+
12+
```
13+
python --version
14+
```
15+
3. Create a virtual environment to manage dependencies. *(required)*
16+
4. Run the following command to install the required dependencies:
17+
```
18+
pip install -r requirements.txt
19+
```
20+
5. Once the dependencies are installed determine valid defaults for your system:
21+
```python
22+
class OperationsCoordinator: # Under this class are where you find configurations for-
23+
def __init__( # controlling the workers per-core and parallel executors.
24+
self,
25+
workers_per_core: int = 4, # Controls number of workers and may notgo under 2 workers.
26+
enable_convergence: bool = True, # Controls dynamic worker counts.
27+
convergence_verbose: bool = False,
28+
base_memory_budget_mb: int = 45, # This is a control for operation memory (adjustable).
29+
num_executors: int = 8, # This controls number of parallel executors.
30+
auto_block_dangerous: bool = False, # Blocks explosive tasks with possibly dangerous inputs.
31+
):
32+
```
33+
34+
6. *Even when using the runner ensure you can handle the concurrent writes, tests are currently limited to 25*.
35+
36+
```
37+
- SLOW (10 writes)
38+
- MODERATE (25 writes)
39+
- FAST (50 writes) Note: Storage must fall within your system's capabilities.
40+
- INSANE (70 writes) <- CAUTION
41+
```
42+
43+
7. Try the runner from a directory above the project root.
44+
```
45+
python -m your_project_root.demo.runner
46+
```
47+
48+
8. Read the proofs for setting up your own tasks and to learn more about the system.

demo/gui_pressure_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def cpu_heavy(size: int):
4949

5050
@task_token_guard(
5151
operation_type='append_log',
52-
tags={'weight': 'heavy', 'storage_speed': 'FAST'},
52+
tags={'weight': 'heavy', 'storage_speed': 'MODERATE'},
5353
)
5454
def append_log(path: str, message: str):
5555
os.makedirs(os.path.dirname(path), exist_ok=True)

demo/io_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from ..token_system import task_token_guard
44

55

6-
@task_token_guard(operation_type='write_json_fast', tags={'weight': 'light', 'storage_speed': 'fast'})
6+
@task_token_guard(operation_type='write_json_fast', tags={'weight': 'light', 'storage_speed': 'MODERATE'})
77
def write_json_fast(path, payload):
88
os.makedirs(os.path.dirname(path), exist_ok=True)
99
with open(path, "w", encoding="utf-8") as f:
@@ -15,7 +15,7 @@ def write_json_fast(path, payload):
1515
}
1616

1717

18-
@task_token_guard(operation_type='append_log_slow', tags={'weight': 'heavy', 'storage_speed': 'fast'})
18+
@task_token_guard(operation_type='append_log_slow', tags={'weight': 'heavy', 'storage_speed': 'MODERATE'})
1919
def append_log_slow(path, message):
2020
os.makedirs(os.path.dirname(path), exist_ok=True)
2121
with open(path, "a", encoding="utf-8") as f:
@@ -26,7 +26,7 @@ def append_log_slow(path, message):
2626
}
2727

2828

29-
@task_token_guard(operation_type='write_blob_moderate', tags={'weight': 'medium', 'storage_speed': 'fast'})
29+
@task_token_guard(operation_type='write_blob_moderate', tags={'weight': 'medium', 'storage_speed': 'MODERATE'})
3030
def write_blob_moderate(path, size_kb):
3131
os.makedirs(os.path.dirname(path), exist_ok=True)
3232
blob = b"x" * (size_kb * 1024)

0 commit comments

Comments
 (0)