Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Mgmt Services
Wellbore
Lib
Wellbore-cloud
Wellbore-azure-lib
Commits
d330c770
Commit
d330c770
authored
Jun 07, 2021
by
Yannick
Browse files
add some logging
parent
677d74d8
Pipeline
#44967
passed with stage
in 50 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
osdu_az/partition/partition_service.py
View file @
d330c770
...
...
@@ -30,7 +30,8 @@ class PartitionService:
@
staticmethod
async
def
get_partition
(
data_partition_id
:
str
)
->
PartitionInfo
:
partition_info
=
PartitionsCache
.
get
(
data_partition_id
)
if
not
partition_info
:
if
partition_info
is
None
:
_LOGGER
.
info
(
f
'Partition info "
{
data_partition_id
}
" not cached => fetch it'
)
partition_info
=
await
PartitionService
.
_partition_client
().
get_partition
(
data_partition_id
)
if
partition_info
:
_LOGGER
.
info
(
f
'PartitionService fetching partition info for "
{
data_partition_id
}
"'
)
...
...
osdu_az/partition/partitions_cache.py
View file @
d330c770
import
logging
from
cachetools
import
TTLCache
_LOGGER
=
logging
.
getLogger
(
__name__
)
class
PartitionsCache
:
partitions_cache
=
TTLCache
(
maxsize
=
100
,
ttl
=
300
)
...
...
@@ -10,6 +13,7 @@ class PartitionsCache:
@
staticmethod
def
set
(
data_partition_id
:
str
,
partition_info
):
_LOGGER
.
info
(
f
"set in partition cache
{
PartitionsCache
}
info from '
{
data_partition_id
}
'"
)
PartitionsCache
.
partitions_cache
[
data_partition_id
]
=
partition_info
@
staticmethod
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment