Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
toargridding
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
toar-public
toargridding
Commits
d434fa30
Commit
d434fa30
authored
1 year ago
by
Carsten Hinz
Browse files
Options
Downloads
Patches
Plain Diff
added a second cahce to preserve deleted entries.
parent
28004e86
No related branches found
No related tags found
1 merge request
!11
Creation of first beta release version
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
toargridding/toar_rest_client.py
+5
-3
5 additions, 3 deletions
toargridding/toar_rest_client.py
with
5 additions
and
3 deletions
toargridding/toar_rest_client.py
+
5
−
3
View file @
d434fa30
...
@@ -99,7 +99,7 @@ class Cache:
...
@@ -99,7 +99,7 @@ class Cache:
"""
"""
def
__init__
(
self
,
cache_dir
:
Path
):
def
__init__
(
self
,
cache_dir
:
Path
,
fn
=
"
status_endpoints
"
):
"""
constructor
"""
constructor
Throws exception if cache directory does not exists.
Throws exception if cache directory does not exists.
...
@@ -111,7 +111,7 @@ class Cache:
...
@@ -111,7 +111,7 @@ class Cache:
if
not
cache_dir
.
exists
():
if
not
cache_dir
.
exists
():
raise
RuntimeError
(
f
"
Given directory for saving cache file does not exists. Path:
{
cache_dir
}
"
)
raise
RuntimeError
(
f
"
Given directory for saving cache file does not exists. Path:
{
cache_dir
}
"
)
self
.
cache_file
=
cache_dir
/
"
status_endpoints
.json
"
self
.
cache_file
=
cache_dir
/
fn
/
"
.json
"
if
not
self
.
cache_file
.
is_file
():
# initialize cache with dummy values
if
not
self
.
cache_file
.
is_file
():
# initialize cache with dummy values
with
open
(
self
.
cache_file
,
"
w
"
)
as
cache
:
with
open
(
self
.
cache_file
,
"
w
"
)
as
cache
:
...
@@ -171,6 +171,7 @@ class Connection:
...
@@ -171,6 +171,7 @@ class Connection:
self
.
endpoint
=
endpoint
self
.
endpoint
=
endpoint
self
.
cache
=
Cache
(
cache_dir
)
self
.
cache
=
Cache
(
cache_dir
)
self
.
cache_backup
=
Cache
(
cache_dir
,
"
status_endpoints.old
"
)
# max wait time is 30min
# max wait time is 30min
self
.
wait_seconds
=
[
minutes
*
60
for
minutes
in
(
5
,
5
,
5
,
5
,
5
,
5
)]
self
.
wait_seconds
=
[
minutes
*
60
for
minutes
in
(
5
,
5
,
5
,
5
,
5
,
5
)]
...
@@ -217,7 +218,8 @@ class Connection:
...
@@ -217,7 +218,8 @@ class Connection:
print
(
"
Reason: {e.response.reason}
"
)
print
(
"
Reason: {e.response.reason}
"
)
print
(
"
Text: {e.response.text}
"
)
print
(
"
Text: {e.response.text}
"
)
#will be overwritten in the next step...
#will be overwritten in the next step...
#self.cache.remove(query_options.cache_key)
self
.
cache_backup
.
put
(
query_options
.
cache_key
,
status_endpoint
)
self
.
cache
.
remove
(
query_options
.
cache_key
)
except
:
except
:
raise
RuntimeError
(
f
"
An error occurred during accessing a cached request
"
)
raise
RuntimeError
(
f
"
An error occurred during accessing a cached request
"
)
else
:
else
:
...
...
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