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
0f42216a
Commit
0f42216a
authored
8 months ago
by
Nils-Arne Dreier
Browse files
Options
Downloads
Patches
Plain Diff
add logging
parent
bc5b25a6
No related branches found
Branches containing commit
Tags
v0.0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/coyote/coyote.py
+15
-2
15 additions, 2 deletions
src/coyote/coyote.py
with
15 additions
and
2 deletions
src/coyote/coyote.py
+
15
−
2
View file @
0f42216a
...
...
@@ -11,6 +11,10 @@ import queue
import
json
from
isodate
import
parse_datetime
import
numpy
as
np
import
logging
_logger
=
logging
.
getLogger
(
'
coyote
'
)
_logger
.
addHandler
(
logging
.
NullHandler
())
class
Coyote
:
...
...
@@ -32,6 +36,7 @@ class Coyote:
self
.
source_fields
=
{}
self
.
frac_masks
=
{}
self
.
frac_mask_buffers
=
{}
_logger
.
info
(
"
Coyote initialized
"
)
self
.
yac
.
sync_def
()
def
add_fields
(
self
,
...
...
@@ -65,6 +70,7 @@ class Coyote:
timestep
,
TimeUnit
.
ISO_FORMAT
,
reduction
,
interpolation_stack
,
**
coupling_args
)
_logger
.
info
(
"
Added fields %s
"
,
variables
)
def
start
(
self
):
self
.
yac
.
enddef
()
...
...
@@ -74,8 +80,10 @@ class Coyote:
def
_work
():
while
any
(
f
.
action
!=
Action
.
OUT_OF_BOUND
for
f
in
self
.
target_fields
.
values
()):
datetime
=
min
(
parse_datetime
(
f
.
datetime
)
for
f
in
self
.
target_fields
.
values
())
_logger
.
info
(
"
Get fields for datetime %s
"
,
datetime
)
for
name
,
f
in
self
.
target_fields
.
items
():
if
parse_datetime
(
f
.
datetime
)
==
datetime
:
_logger
.
info
(
"
Get %s
"
,
name
)
data
,
info
=
f
.
get
()
q
.
put
((
name
,
data
,
{
"
action_info
"
:
info
,
...
...
@@ -83,19 +91,23 @@ class Coyote:
if
name
in
self
.
frac_mask_buffers
.
keys
():
self
.
frac_mask_buffers
[
name
][:]
=
data
pass_through_q
.
put
((
name
,
data
,
self
.
frac_masks
[
name
]))
_logger
.
info
(
"
Timeloop ended
"
)
q
.
put
(
None
)
q
.
join
()
pass_through_q
.
put
(
None
)
pass_through_q
.
join
()
_logger
.
info
(
"
worker finished
"
)
t
=
Thread
(
target
=
_work
)
t
.
start
()
def
_work_pass_through
():
while
(
elem
:
=
pass_through_q
.
get
())
is
not
None
:
name
,
data
,
frac_mask
=
elem
_logger
.
info
(
"
Put %s
"
,
name
)
self
.
source_fields
[
name
].
put
(
data
,
frac_mask
=
frac_mask
)
pass_through_q
.
task_done
()
pass_through_q
.
task_done
()
_logger
.
info
(
"
pass through worker finished
"
)
pass_through_t
=
Thread
(
target
=
_work_pass_through
)
pass_through_t
.
start
()
...
...
@@ -103,7 +115,8 @@ class Coyote:
yield
elem
q
.
task_done
()
q
.
task_done
()
print
(
"
waiting for worker
"
)
# TODO switch to logging
_logger
.
info
(
"
waiting for workers
"
)
t
.
join
()
pass_through_t
.
join
()
print
(
"
d
one
"
)
# TODO switch to logging
_logger
.
info
(
"
D
one
!
"
)
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