ahaz_common 0.0.1__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.
- ahaz_common-0.0.1/PKG-INFO +5 -0
- ahaz_common-0.0.1/ahaz_common/__init__.py +2 -0
- ahaz_common-0.0.1/ahaz_common/server.py +37 -0
- ahaz_common-0.0.1/ahaz_common/task.py +81 -0
- ahaz_common-0.0.1/ahaz_common.egg-info/PKG-INFO +5 -0
- ahaz_common-0.0.1/ahaz_common.egg-info/SOURCES.txt +9 -0
- ahaz_common-0.0.1/ahaz_common.egg-info/dependency_links.txt +1 -0
- ahaz_common-0.0.1/ahaz_common.egg-info/requires.txt +1 -0
- ahaz_common-0.0.1/ahaz_common.egg-info/top_level.txt +1 -0
- ahaz_common-0.0.1/pyproject.toml +5 -0
- ahaz_common-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ChallengeRequest(BaseModel):
|
|
5
|
+
team_id: str
|
|
6
|
+
challenge_id: str
|
|
7
|
+
|
|
8
|
+
def __str__(self):
|
|
9
|
+
return f"ChallengeRequest(team_id={self.team_id}, challenge_id={self.challenge_id})"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TeamRequest(BaseModel):
|
|
13
|
+
team_id: str
|
|
14
|
+
|
|
15
|
+
def __str__(self):
|
|
16
|
+
return f"TeamRequest(team_id={self.team_id})"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class UserRequest(BaseModel):
|
|
20
|
+
team_id: str
|
|
21
|
+
user_id: str
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
return f"UserRequest(user_id={self.user_id}, team_id={self.team_id})"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class RegisterTeamRequest(BaseModel):
|
|
28
|
+
team_id: str
|
|
29
|
+
domain_name: str
|
|
30
|
+
port: int
|
|
31
|
+
protocol: str
|
|
32
|
+
|
|
33
|
+
def __str__(self):
|
|
34
|
+
return (
|
|
35
|
+
f"RegisterTeamRequest(team_id={self.team_id}, domain_name={self.domain_name}, "
|
|
36
|
+
f"port={self.port}, protocol={self.protocol})"
|
|
37
|
+
)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BuildArg(BaseModel):
|
|
7
|
+
name: str
|
|
8
|
+
value: str
|
|
9
|
+
|
|
10
|
+
def __str__(self):
|
|
11
|
+
return f"BuildArgs(name={self.name}, value={self.value})"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Image(BaseModel):
|
|
15
|
+
image_name: str
|
|
16
|
+
build_context: str
|
|
17
|
+
build_args: Optional[list[BuildArg]] = None
|
|
18
|
+
|
|
19
|
+
def __str__(self):
|
|
20
|
+
return (
|
|
21
|
+
f"Image(image_name={self.image_name}, build_context={self.build_context}, "
|
|
22
|
+
f"build_args={self.build_args})"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class TestEnv(BaseModel):
|
|
27
|
+
exposed_ports: list[str] # Mapping of container port to host port
|
|
28
|
+
|
|
29
|
+
def __str__(self):
|
|
30
|
+
return f"TestEnv(exposed_ports={self.exposed_ports})"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Pod(BaseModel):
|
|
34
|
+
name: str
|
|
35
|
+
# TODO: Support multi-image pods
|
|
36
|
+
image: Image
|
|
37
|
+
limits_ram: str
|
|
38
|
+
limits_cpu: int
|
|
39
|
+
visible_to_user: bool
|
|
40
|
+
testing: Optional[TestEnv] = None
|
|
41
|
+
|
|
42
|
+
def __str__(self):
|
|
43
|
+
return (
|
|
44
|
+
f"Pod(name={self.name}, image={self.image}, limits_ram={self.limits_ram}, "
|
|
45
|
+
f"limits_cpu={self.limits_cpu}, visible_to_user={self.visible_to_user}, testing={self.testing})"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Network(BaseModel):
|
|
50
|
+
name: str
|
|
51
|
+
devices: list[str]
|
|
52
|
+
|
|
53
|
+
def __str__(self):
|
|
54
|
+
return f"Networks(name={self.name}, devices={self.devices})"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class EnvVar(BaseModel):
|
|
58
|
+
pod_name: str
|
|
59
|
+
name: str
|
|
60
|
+
value: str
|
|
61
|
+
|
|
62
|
+
def __str__(self):
|
|
63
|
+
return f"EnvVars(pod_name={self.pod_name}, name={self.name}, value={self.value})"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Task(BaseModel):
|
|
67
|
+
name: str
|
|
68
|
+
version: str
|
|
69
|
+
description: str
|
|
70
|
+
score: int
|
|
71
|
+
scoring_type: str
|
|
72
|
+
pods: list[Pod]
|
|
73
|
+
networks: list[Network]
|
|
74
|
+
env_vars: Optional[list[EnvVar]] = None
|
|
75
|
+
|
|
76
|
+
def __str__(self):
|
|
77
|
+
return (
|
|
78
|
+
f"Task(name={self.name}, description={self.description}, score={self.score}, "
|
|
79
|
+
f"scoring_type={self.scoring_type}, pods={self.pods}, networks={self.networks}, "
|
|
80
|
+
f"env_vars={self.env_vars})"
|
|
81
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
ahaz_common/__init__.py
|
|
3
|
+
ahaz_common/server.py
|
|
4
|
+
ahaz_common/task.py
|
|
5
|
+
ahaz_common.egg-info/PKG-INFO
|
|
6
|
+
ahaz_common.egg-info/SOURCES.txt
|
|
7
|
+
ahaz_common.egg-info/dependency_links.txt
|
|
8
|
+
ahaz_common.egg-info/requires.txt
|
|
9
|
+
ahaz_common.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pydantic>=2.12.3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ahaz_common
|