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
62af3eee
Commit
62af3eee
authored
1 year ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
correct issue that get_data return None instead of raise an error
parent
8b41958b
No related branches found
Branches containing commit
No related tags found
3 merge requests
!522
filter can now combine obs, forecast, and apriori for first iteration. Further...
,
!521
Resolve "release v2.4.0"
,
!516
Resolve "advanced retry strategy"
Pipeline
#142645
failed
1 year ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlair/helpers/data_sources/data_loader.py
+5
-5
5 additions, 5 deletions
mlair/helpers/data_sources/data_loader.py
with
5 additions
and
5 deletions
mlair/helpers/data_sources/data_loader.py
+
5
−
5
View file @
62af3eee
...
@@ -85,7 +85,7 @@ class EmptyQueryResult(Exception):
...
@@ -85,7 +85,7 @@ class EmptyQueryResult(Exception):
pass
pass
def
get_data
(
opts
:
Dict
,
headers
:
Dict
,
as_json
:
bool
=
True
,
max_retries
=
5
)
->
Union
[
Dict
,
List
,
str
]:
def
get_data
(
opts
:
Dict
,
headers
:
Dict
,
as_json
:
bool
=
True
,
max_retries
=
5
,
timeout_base
=
60
)
->
Union
[
Dict
,
List
,
str
]:
"""
"""
Download join data using requests framework.
Download join data using requests framework.
...
@@ -98,10 +98,10 @@ def get_data(opts: Dict, headers: Dict, as_json: bool = True, max_retries=5) ->
...
@@ -98,10 +98,10 @@ def get_data(opts: Dict, headers: Dict, as_json: bool = True, max_retries=5) ->
:return: requested data (either as list or dictionary)
:return: requested data (either as list or dictionary)
"""
"""
url
=
create_url
(
**
opts
)
url
=
create_url
(
**
opts
)
for
retry
in
range
(
max_retries
):
for
retry
in
range
(
max_retries
+
1
):
time
.
sleep
(
random
.
random
())
time
.
sleep
(
random
.
random
())
try
:
try
:
timeout
=
60
*
(
2
**
retry
)
timeout
=
timeout_base
*
(
2
**
retry
)
logging
.
info
(
f
"
connect (retry=
{
retry
}
, timeout=
{
timeout
}
)
{
url
}
"
)
logging
.
info
(
f
"
connect (retry=
{
retry
}
, timeout=
{
timeout
}
)
{
url
}
"
)
with
TimeTracking
(
name
=
url
):
with
TimeTracking
(
name
=
url
):
session
=
retries_session
(
max_retries
=
0
)
session
=
retries_session
(
max_retries
=
0
)
...
@@ -113,8 +113,8 @@ def get_data(opts: Dict, headers: Dict, as_json: bool = True, max_retries=5) ->
...
@@ -113,8 +113,8 @@ def get_data(opts: Dict, headers: Dict, as_json: bool = True, max_retries=5) ->
except
Exception
as
e
:
except
Exception
as
e
:
time
.
sleep
(
retry
)
time
.
sleep
(
retry
)
logging
.
debug
(
f
"
There was an error for request
{
url
}
:
{
e
}
"
)
logging
.
debug
(
f
"
There was an error for request
{
url
}
:
{
e
}
"
)
if
retry
+
1
>=
max_retries
:
if
retry
+
1
>=
max_retries
:
raise
EmptyQueryResult
(
f
"
There was an RetryError for request
{
url
}
:
{
e
}
"
)
raise
EmptyQueryResult
(
f
"
There was an RetryError for request
{
url
}
:
{
e
}
"
)
def
correct_stat_name
(
stat
:
str
)
->
str
:
def
correct_stat_name
(
stat
:
str
)
->
str
:
...
...
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