Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coyote
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nils
coyote
Commits
2bc38538
Commit
2bc38538
authored
4 months ago
by
Nils-Arne Dreier
Browse files
Options
Downloads
Patches
Plain Diff
fix: improve current-timestep impl
parent
ad19ad71
No related branches found
No related tags found
1 merge request
!18
feat(loco): add http endpoint for requesting the current timestep index
Pipeline
#90639
passed
4 months ago
Stage: lint
Stage: build
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/hiopy/_data_handler.py
+1
-1
1 addition, 1 deletion
apps/hiopy/_data_handler.py
apps/hiopy/loco.py
+10
-6
10 additions, 6 deletions
apps/hiopy/loco.py
with
11 additions
and
7 deletions
apps/hiopy/_data_handler.py
+
1
−
1
View file @
2bc38538
...
...
@@ -35,7 +35,7 @@ class DataHandler:
self
.
var
[
self
.
t_flushed
:
self
.
t
,
...,
self
.
cell_slice
]
=
self
.
buf
[
fro
:
to
,
...]
self
.
t_flushed
=
self
.
t
if
self
.
loco_server
is
not
None
:
self
.
loco_server
.
set_timestep
(
self
.
t
-
1
)
self
.
loco_server
.
set_timestep
(
self
.
var
.
name
,
self
.
t
-
1
)
def
__call__
(
self
,
event
):
self
.
buf
[
self
.
t
%
self
.
time_chunk_size
,
...]
=
np
.
transpose
(
event
.
data
)
...
...
This diff is collapsed.
Click to expand it.
apps/hiopy/loco.py
+
10
−
6
View file @
2bc38538
...
...
@@ -6,11 +6,15 @@ from aiohttp import web
class
LocoServer
:
def
__init__
(
self
,
store
,
host
=
"
0.0.0.0
"
,
port
=
8080
):
self
.
timestep
=
None
self
.
timestep
=
dict
()
self
.
port
=
port
def
_serve_current_timestep
(
request
):
return
web
.
Response
(
body
=
str
(
self
.
timestep
))
if
len
(
self
.
timestep
)
>
0
:
t_idx
=
min
(
self
.
timestep
.
values
())
else
:
return
web
.
Response
(
status
=
204
)
return
web
.
json_response
({
"
timestep
"
:
int
(
t_idx
)})
def
_serve
(
request
):
try
:
...
...
@@ -29,14 +33,14 @@ class LocoServer:
loop
.
run_forever
()
app
=
web
.
Application
()
app
.
add_routes
([
web
.
get
(
"
/current
_
timestep
"
,
_serve_current_timestep
)])
app
.
add_routes
([
web
.
get
(
"
/current
-
timestep
"
,
_serve_current_timestep
)])
app
.
add_routes
([
web
.
get
(
"
/{key:.*}
"
,
_serve
)])
runner
=
web
.
AppRunner
(
app
)
t
=
Thread
(
target
=
_run_server
,
args
=
(
runner
,
host
,
port
),
daemon
=
True
)
t
.
start
()
def
set_timestep
(
self
,
timestep
):
self
.
timestep
=
timestep
def
set_timestep
(
self
,
varname
,
timestep
):
self
.
timestep
[
varname
]
=
timestep
def
write_nginx_config
(
self
,
distributed_data_vars
,
rank
):
import
platform
...
...
@@ -68,7 +72,7 @@ class LocoServer:
# use last rank for timestep assumption: this rank has
# the healpix order 0 grid where the information
# arrives last
f
.
write
(
f
'
"
/current
_
timestep
"
loco_backend
{
r
}
;
\n
'
)
f
.
write
(
f
'
"
/current
-
timestep
"
loco_backend
{
r
}
;
\n
'
)
f
.
write
(
"
}
\n\n
"
)
for
i
in
range
(
len
(
distributed_data_vars
)):
...
...
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