Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
esde
machine-learning
MLAir
Commits
71a0c592
Commit
71a0c592
authored
4 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
first implementation to check on hpc
parent
60048b9d
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!226
Develop
,
!225
Resolve "release v1.2.0"
,
!195
Resolve "Parallel station check"
Pipeline
#52919
failed
4 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/run_modules/pre_processing.py
+46
-0
46 additions, 0 deletions
mlair/run_modules/pre_processing.py
with
46 additions
and
0 deletions
mlair/run_modules/pre_processing.py
+
46
−
0
View file @
71a0c592
...
...
@@ -6,6 +6,7 @@ __date__ = '2019-11-25'
import
logging
import
os
from
typing
import
Tuple
import
multiprocessing
import
numpy
as
np
import
pandas
as
pd
...
...
@@ -201,6 +202,42 @@ class PreProcessing(RunEnvironment):
Valid means, that there is data available for the given time range (is included in `kwargs`). The shape and the
loading time are logged in debug mode.
:return: Corrected list containing only valid station IDs.
"""
t_outer
=
TimeTracking
()
logging
.
info
(
f
"
check valid stations started
{
'
(%s)
'
%
(
set_name
if
set_name
is
not
None
else
'
all
'
)
}
"
)
# calculate transformation using train data
if
set_name
==
"
train
"
:
logging
.
info
(
"
setup transformation using train data exclusively
"
)
self
.
transformation
(
data_handler
,
set_stations
)
# start station check
collection
=
DataCollection
()
valid_stations
=
[]
kwargs
=
self
.
data_store
.
create_args_dict
(
data_handler
.
requirements
(),
scope
=
set_name
)
logging
.
info
(
"
-------start parallel loop------
"
)
pool
=
multiprocessing
.
Pool
(
4
)
output
=
[
pool
.
apply_async
(
f_proc
,
args
=
(
data_handler
,
station
,
set_name
,
store_processed_data
),
kwds
=
kwargs
)
for
station
in
set_stations
]
for
p
in
output
:
dh
,
s
=
p
.
get
()
if
dh
is
not
None
:
collection
.
add
(
dh
)
valid_stations
.
append
(
s
)
logging
.
info
(
f
"
run for
{
t_outer
}
to check
{
len
(
set_stations
)
}
station(s). Found
{
len
(
collection
)
}
/
"
f
"
{
len
(
set_stations
)
}
valid stations.
"
)
return
collection
,
valid_stations
def
validate_station_old
(
self
,
data_handler
:
AbstractDataHandler
,
set_stations
,
set_name
=
None
,
store_processed_data
=
True
):
"""
Check if all given stations in `all_stations` are valid.
Valid means, that there is data available for the given time range (is included in `kwargs`). The shape and the
loading time are logged in debug mode.
:return: Corrected list containing only valid station IDs.
"""
t_outer
=
TimeTracking
()
...
...
@@ -231,3 +268,12 @@ class PreProcessing(RunEnvironment):
transformation_dict
=
data_handler
.
transformation
(
stations
,
**
kwargs
)
if
transformation_dict
is
not
None
:
self
.
data_store
.
set
(
"
transformation
"
,
transformation_dict
)
def
f_proc
(
data_handler
,
station
,
name_affix
,
store
,
**
kwargs
):
try
:
res
=
data_handler
.
build
(
station
,
name_affix
=
name_affix
,
store_processed_data
=
store
,
**
kwargs
)
except
(
AttributeError
,
EmptyQueryResult
):
res
=
None
return
res
,
station
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