Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
shared-libs
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pi-Lab
shared-libs
Commits
30f591e5
Commit
30f591e5
authored
2 years ago
by
istmxrein
Browse files
Options
Downloads
Patches
Plain Diff
Add update models to meta events
parent
5c09b46b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pilab/events/meta.py
+23
-7
23 additions, 7 deletions
pilab/events/meta.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
24 additions
and
8 deletions
pilab/events/meta.py
+
23
−
7
View file @
30f591e5
...
@@ -15,10 +15,9 @@ from pilab.events import utils
...
@@ -15,10 +15,9 @@ from pilab.events import utils
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
class
EventType
(
str
,
Enum
):
CREATE
=
'
create
'
def
convert_to_optional
(
schema
):
UPDATE
=
'
update
'
return
{
k
:
Optional
[
v
]
for
k
,
v
in
schema
.
__annotations__
.
items
()
if
k
!=
"
id
"
}
DELETE
=
'
delete
'
class
Host
(
BaseModel
):
class
Host
(
BaseModel
):
...
@@ -31,6 +30,13 @@ class Host(BaseModel):
...
@@ -31,6 +30,13 @@ class Host(BaseModel):
hostname
:
str
hostname
:
str
class
HostUpdate
(
Host
):
"""
representation of host for update
"""
__annotations__
=
convert_to_optional
(
Host
)
class
Pi
(
Host
):
class
Pi
(
Host
):
"""
"""
representation of pi object with host id
representation of pi object with host id
...
@@ -39,7 +45,13 @@ class Pi(Host):
...
@@ -39,7 +45,13 @@ class Pi(Host):
display
:
bool
display
:
bool
position
:
int
position
:
int
ssh_host_ed25519_key
:
Optional
[
str
]
ssh_host_ed25519_key
:
Optional
[
str
]
pass
class
PiUpdate
(
HostUpdate
):
"""
representation of pi object for update
"""
__annotations__
=
convert_to_optional
(
Pi
)
class
Cube
(
BaseModel
):
class
Cube
(
BaseModel
):
...
@@ -51,14 +63,18 @@ class Cube(BaseModel):
...
@@ -51,14 +63,18 @@ class Cube(BaseModel):
switch
:
Host
switch
:
Host
head
:
Pi
head
:
Pi
workers
:
List
[
Pi
]
workers
:
List
[
Pi
]
pass
class
EventType
(
str
,
Enum
):
CREATE
=
'
create
'
UPDATE
=
'
update
'
DELETE
=
'
delete
'
class
Event
(
BaseModel
):
class
Event
(
BaseModel
):
type
:
EventType
type
:
EventType
timestamp
:
float
timestamp
:
float
payload
:
Cube
payload
:
Cube
pass
class
EventListener
(
threading
.
Thread
):
class
EventListener
(
threading
.
Thread
):
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
30f591e5
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup
(
setup
(
name
=
'
pilab
'
,
name
=
'
pilab
'
,
version
=
'
2.
0
.0
'
,
version
=
'
2.
1
.0
'
,
description
=
'
Shared-Libs for the pi-lab microservices
'
,
description
=
'
Shared-Libs for the pi-lab microservices
'
,
url
=
'
https://code.fbi.h-da.de/api/v4/projects/27896/packages/pypi/pilab
'
,
url
=
'
https://code.fbi.h-da.de/api/v4/projects/27896/packages/pypi/pilab
'
,
author
=
'
Max Reinheimer
'
,
author
=
'
Max Reinheimer
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment