jac-scale 0.1.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.
Files changed (57) hide show
  1. jac_scale/__init__.py +0 -0
  2. jac_scale/abstractions/config/app_config.jac +30 -0
  3. jac_scale/abstractions/config/base_config.jac +26 -0
  4. jac_scale/abstractions/database_provider.jac +51 -0
  5. jac_scale/abstractions/deployment_target.jac +64 -0
  6. jac_scale/abstractions/image_registry.jac +54 -0
  7. jac_scale/abstractions/logger.jac +20 -0
  8. jac_scale/abstractions/models/deployment_result.jac +27 -0
  9. jac_scale/abstractions/models/resource_status.jac +38 -0
  10. jac_scale/config_loader.jac +31 -0
  11. jac_scale/context.jac +14 -0
  12. jac_scale/factories/database_factory.jac +43 -0
  13. jac_scale/factories/deployment_factory.jac +43 -0
  14. jac_scale/factories/registry_factory.jac +32 -0
  15. jac_scale/factories/utility_factory.jac +34 -0
  16. jac_scale/impl/config_loader.impl.jac +131 -0
  17. jac_scale/impl/context.impl.jac +24 -0
  18. jac_scale/impl/memory_hierarchy.main.impl.jac +63 -0
  19. jac_scale/impl/memory_hierarchy.mongo.impl.jac +239 -0
  20. jac_scale/impl/memory_hierarchy.redis.impl.jac +186 -0
  21. jac_scale/impl/serve.impl.jac +1785 -0
  22. jac_scale/jserver/__init__.py +0 -0
  23. jac_scale/jserver/impl/jfast_api.impl.jac +731 -0
  24. jac_scale/jserver/impl/jserver.impl.jac +79 -0
  25. jac_scale/jserver/jfast_api.jac +162 -0
  26. jac_scale/jserver/jserver.jac +101 -0
  27. jac_scale/memory_hierarchy.jac +138 -0
  28. jac_scale/plugin.jac +218 -0
  29. jac_scale/plugin_config.jac +175 -0
  30. jac_scale/providers/database/kubernetes_mongo.jac +137 -0
  31. jac_scale/providers/database/kubernetes_redis.jac +110 -0
  32. jac_scale/providers/registry/dockerhub.jac +64 -0
  33. jac_scale/serve.jac +118 -0
  34. jac_scale/targets/kubernetes/kubernetes_config.jac +215 -0
  35. jac_scale/targets/kubernetes/kubernetes_target.jac +841 -0
  36. jac_scale/targets/kubernetes/utils/kubernetes_utils.impl.jac +519 -0
  37. jac_scale/targets/kubernetes/utils/kubernetes_utils.jac +85 -0
  38. jac_scale/tests/__init__.py +0 -0
  39. jac_scale/tests/conftest.py +29 -0
  40. jac_scale/tests/fixtures/test_api.jac +159 -0
  41. jac_scale/tests/fixtures/todo_app.jac +68 -0
  42. jac_scale/tests/test_abstractions.py +88 -0
  43. jac_scale/tests/test_deploy_k8s.py +265 -0
  44. jac_scale/tests/test_examples.py +484 -0
  45. jac_scale/tests/test_factories.py +149 -0
  46. jac_scale/tests/test_file_upload.py +444 -0
  47. jac_scale/tests/test_k8s_utils.py +156 -0
  48. jac_scale/tests/test_memory_hierarchy.py +247 -0
  49. jac_scale/tests/test_serve.py +1835 -0
  50. jac_scale/tests/test_sso.py +711 -0
  51. jac_scale/utilities/loggers/standard_logger.jac +40 -0
  52. jac_scale/utils.jac +16 -0
  53. jac_scale-0.1.1.dist-info/METADATA +658 -0
  54. jac_scale-0.1.1.dist-info/RECORD +57 -0
  55. jac_scale-0.1.1.dist-info/WHEEL +5 -0
  56. jac_scale-0.1.1.dist-info/entry_points.txt +3 -0
  57. jac_scale-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,215 @@
1
+ """Kubernetes-specific configuration."""
2
+ import from typing { Any }
3
+ import from jac_scale.abstractions.config.base_config { BaseConfig }
4
+
5
+ """Configuration for Kubernetes deployments."""
6
+ class KubernetesConfig(BaseConfig) {
7
+ has docker_image_name: str = '',
8
+ docker_username: str = '',
9
+ docker_password: str = '',
10
+ container_port: int = 8000,
11
+ node_port: int = 30001,
12
+ mongodb_enabled: bool = True,
13
+ redis_enabled: bool = True,
14
+ cpu_request: (str | None) = None,
15
+ cpu_limit: (str | None) = None,
16
+ memory_request: (str | None) = None,
17
+ memory_limit: (str | None) = None,
18
+ readiness_initial_delay: int = 10,
19
+ readiness_period: int = 20,
20
+ liveness_initial_delay: int = 10,
21
+ liveness_period: int = 20,
22
+ liveness_failure_threshold: int = 80,
23
+ health_check_path: str = '/docs',
24
+ # Runtime configuration
25
+ python_image: str = 'python:3.12-slim',
26
+ busybox_image: str = 'busybox:1.36',
27
+ wait_image: str = 'busybox',
28
+ # Storage configuration
29
+ pvc_size: str = '5Gi',
30
+ # Timing configuration
31
+ resource_deletion_wait: int = 5,
32
+ aws_nlb_wait: int = 60,
33
+ # Paths
34
+ app_mount_path: str = '/app',
35
+ code_mount_path: str = '/code',
36
+ workspace_path: str = '/code/workspace',
37
+ # Runtime environment (defaults to official Jaseci repo)
38
+ jaseci_repo_url: str = 'https://github.com/jaseci-labs/jaseci.git',
39
+ jaseci_branch: str = 'main',
40
+ jaseci_commit: (str | None) = None,
41
+ install_jaseci: bool = True,
42
+ additional_packages: list[str] = [];
43
+
44
+ def init(
45
+ self: KubernetesConfig,
46
+ app_name: str = 'jaseci',
47
+ namespace: str = 'default',
48
+ docker_image_name: str = '',
49
+ docker_username: str = '',
50
+ docker_password: str = '',
51
+ container_port: int = 8000,
52
+ node_port: int = 30001,
53
+ mongodb_enabled: bool = True,
54
+ redis_enabled: bool = True,
55
+ cpu_request: (str | None) = None,
56
+ cpu_limit: (str | None) = None,
57
+ memory_request: (str | None) = None,
58
+ memory_limit: (str | None) = None,
59
+ readiness_initial_delay: int = 10,
60
+ readiness_period: int = 20,
61
+ liveness_initial_delay: int = 10,
62
+ liveness_period: int = 20,
63
+ liveness_failure_threshold: int = 80,
64
+ health_check_path: str = '/docs',
65
+ python_image: str = 'python:3.12-slim',
66
+ busybox_image: str = 'busybox:1.36',
67
+ wait_image: str = 'busybox',
68
+ pvc_size: str = '5Gi',
69
+ resource_deletion_wait: int = 5,
70
+ aws_nlb_wait: int = 60,
71
+ app_mount_path: str = '/app',
72
+ code_mount_path: str = '/code',
73
+ workspace_path: str = '/code/workspace',
74
+ jaseci_repo_url: str = 'https://github.com/jaseci-labs/jaseci.git',
75
+ jaseci_branch: str = 'main',
76
+ jaseci_commit: (str | None) = None,
77
+ install_jaseci: bool = True,
78
+ additional_packages: list[str] = []
79
+ # Runtime configuration
80
+ # Storage configuration
81
+ # Timing configuration
82
+ # Paths
83
+ # Runtime environment
84
+ ) -> None {
85
+ self.app_name = app_name;
86
+ self.namespace = namespace;
87
+ # Initialize derived class fields
88
+ self.docker_image_name = docker_image_name;
89
+ self.docker_username = docker_username;
90
+ self.docker_password = docker_password;
91
+ self.container_port = container_port;
92
+ self.node_port = node_port;
93
+ self.mongodb_enabled = mongodb_enabled;
94
+ self.redis_enabled = redis_enabled;
95
+ self.cpu_request = cpu_request;
96
+ self.cpu_limit = cpu_limit;
97
+ self.memory_request = memory_request;
98
+ self.memory_limit = memory_limit;
99
+ self.readiness_initial_delay = readiness_initial_delay;
100
+ self.readiness_period = readiness_period;
101
+ self.liveness_initial_delay = liveness_initial_delay;
102
+ self.liveness_period = liveness_period;
103
+ self.liveness_failure_threshold = liveness_failure_threshold;
104
+ self.health_check_path = health_check_path;
105
+ # Runtime configuration
106
+ self.python_image = python_image;
107
+ self.busybox_image = busybox_image;
108
+ self.wait_image = wait_image;
109
+ # Storage configuration
110
+ self.pvc_size = pvc_size;
111
+ # Timing configuration
112
+ self.resource_deletion_wait = resource_deletion_wait;
113
+ self.aws_nlb_wait = aws_nlb_wait;
114
+ # Paths
115
+ self.app_mount_path = app_mount_path;
116
+ self.code_mount_path = code_mount_path;
117
+ self.workspace_path = workspace_path;
118
+ # Runtime environment
119
+ self.jaseci_repo_url = jaseci_repo_url;
120
+ self.jaseci_branch = jaseci_branch;
121
+ self.jaseci_commit = jaseci_commit;
122
+ self.install_jaseci = install_jaseci;
123
+ self.additional_packages = additional_packages;
124
+ }
125
+
126
+ override def to_dict(self: KubernetesConfig) -> dict[str, Any] {
127
+ base = super.to_dict();
128
+ base.update(
129
+ {
130
+ 'docker_image_name': self.docker_image_name,
131
+ 'docker_username': self.docker_username,
132
+ 'docker_password': self.docker_password,
133
+ 'container_port': self.container_port,
134
+ 'node_port': self.node_port,
135
+ 'mongodb_enabled': self.mongodb_enabled,
136
+ 'redis_enabled': self.redis_enabled,
137
+ 'cpu_request': self.cpu_request,
138
+ 'cpu_limit': self.cpu_limit,
139
+ 'memory_request': self.memory_request,
140
+ 'memory_limit': self.memory_limit,
141
+ 'readiness_initial_delay': self.readiness_initial_delay,
142
+ 'readiness_period': self.readiness_period,
143
+ 'liveness_initial_delay': self.liveness_initial_delay,
144
+ 'liveness_period': self.liveness_period,
145
+ 'liveness_failure_threshold': self.liveness_failure_threshold,
146
+ 'health_check_path': self.health_check_path,
147
+ # Runtime configuration
148
+ 'python_image': self.python_image,
149
+ 'busybox_image': self.busybox_image,
150
+ 'wait_image': self.wait_image,
151
+ # Storage configuration
152
+ 'pvc_size': self.pvc_size,
153
+ # Timing configuration
154
+ 'resource_deletion_wait': self.resource_deletion_wait,
155
+ 'aws_nlb_wait': self.aws_nlb_wait,
156
+ # Paths
157
+ 'app_mount_path': self.app_mount_path,
158
+ 'code_mount_path': self.code_mount_path,
159
+ 'workspace_path': self.workspace_path,
160
+ # Runtime environment
161
+ 'jaseci_repo_url': self.jaseci_repo_url,
162
+ 'jaseci_branch': self.jaseci_branch,
163
+ 'jaseci_commit': self.jaseci_commit,
164
+ 'install_jaseci': self.install_jaseci,
165
+ 'additional_packages': self.additional_packages
166
+ }
167
+ );
168
+ return base;
169
+ }
170
+
171
+ static def from_dict(cls: type, config: dict[str, Any]) -> KubernetesConfig {
172
+ return cls(
173
+ app_name=config.get('app_name', 'jaseci'),
174
+ namespace=config.get('namespace', 'default'),
175
+ docker_image_name=config.get('docker_image_name', ''),
176
+ docker_username=config.get('docker_username', ''),
177
+ docker_password=config.get('docker_password', ''),
178
+ container_port=config.get('container_port', 8000),
179
+ node_port=config.get('node_port', 30001),
180
+ mongodb_enabled=config.get('mongodb_enabled', True),
181
+ redis_enabled=config.get('redis_enabled', True),
182
+ cpu_request=config.get('cpu_request'),
183
+ cpu_limit=config.get('cpu_limit'),
184
+ memory_request=config.get('memory_request'),
185
+ memory_limit=config.get('memory_limit'),
186
+ readiness_initial_delay=config.get('readiness_initial_delay', 10),
187
+ readiness_period=config.get('readiness_period', 20),
188
+ liveness_initial_delay=config.get('liveness_initial_delay', 10),
189
+ liveness_period=config.get('liveness_period', 20),
190
+ liveness_failure_threshold=config.get('liveness_failure_threshold', 80),
191
+ health_check_path=config.get('health_check_path', '/docs'),
192
+ python_image=config.get('python_image', 'python:3.12-slim'),
193
+ busybox_image=config.get('busybox_image', 'busybox:1.36'),
194
+ wait_image=config.get('wait_image', 'busybox'),
195
+ pvc_size=config.get('pvc_size', '5Gi'),
196
+ resource_deletion_wait=config.get('resource_deletion_wait', 5),
197
+ aws_nlb_wait=config.get('aws_nlb_wait', 60),
198
+ app_mount_path=config.get('app_mount_path', '/app'),
199
+ code_mount_path=config.get('code_mount_path', '/code'),
200
+ workspace_path=config.get('workspace_path', '/code/workspace'),
201
+ jaseci_repo_url=config.get(
202
+ 'jaseci_repo_url', 'https://github.com/jaseci-labs/jaseci.git'
203
+ ),
204
+ jaseci_branch=config.get('jaseci_branch', 'main'),
205
+ jaseci_commit=config.get('jaseci_commit'),
206
+ install_jaseci=config.get('install_jaseci', True),
207
+ additional_packages=config.get('additional_packages', [])
208
+ # Runtime configuration
209
+ # Storage configuration
210
+ # Timing configuration
211
+ # Paths
212
+ # Runtime environment
213
+ );
214
+ }
215
+ }