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
feb18cbb
Commit
feb18cbb
authored
Jun 07, 2021
by
Yannick
Browse files
async.lock around update cache
parent
f10ab48a
Pipeline
#45019
passed with stage
in 2 minutes and 21 seconds
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
osdu_az/partition/partition_info.py
View file @
feb18cbb
...
@@ -2,7 +2,6 @@ import logging
...
@@ -2,7 +2,6 @@ import logging
from
typing
import
Optional
from
typing
import
Optional
from
datetime
import
datetime
from
datetime
import
datetime
from
osdu_az
import
conf
from
osdu_az.identity.az_identity
import
AzureIdentity
from
osdu_az.identity.az_identity
import
AzureIdentity
...
...
osdu_az/partition/partition_service.py
View file @
feb18cbb
import
logging
import
logging
from
os
import
environ
from
os
import
environ
import
asyncio
from
osdu_az.opendes.fake_partition_client
import
FakePartitionClient
from
osdu_az.opendes.fake_partition_client
import
FakePartitionClient
from
osdu_az.opendes.partition_client
import
PartitionClient
from
osdu_az.opendes.partition_client
import
PartitionClient
from
osdu_az.partition.partition_info
import
PartitionInfo
from
osdu_az.partition.partition_info
import
PartitionInfo
...
@@ -26,11 +26,15 @@ PARTITION_ID = 'id'
...
@@ -26,11 +26,15 @@ PARTITION_ID = 'id'
class
PartitionService
:
class
PartitionService
:
partition_client
=
None
partition_client
=
None
scope
=
''
scope
=
''
partition_cache_lock
=
asyncio
.
Lock
()
@
staticmethod
@
staticmethod
async
def
get_partition
(
data_partition_id
:
str
)
->
PartitionInfo
:
async
def
get_partition
(
data_partition_id
:
str
)
->
PartitionInfo
:
partition_info
=
PartitionsCache
.
get
(
data_partition_id
)
partition_info
=
PartitionsCache
.
get
(
data_partition_id
)
if
not
partition_info
:
if
partition_info
is
None
:
async
with
PartitionService
.
partition_cache_lock
:
partition_info
=
PartitionsCache
.
get
(
data_partition_id
)
if
partition_info
is
None
:
partition_info
=
await
PartitionService
.
_partition_client
().
get_partition
(
data_partition_id
)
partition_info
=
await
PartitionService
.
_partition_client
().
get_partition
(
data_partition_id
)
if
partition_info
:
if
partition_info
:
_LOGGER
.
info
(
f
'PartitionService fetching partition info for "
{
data_partition_id
}
"'
)
_LOGGER
.
info
(
f
'PartitionService fetching partition info for "
{
data_partition_id
}
"'
)
...
...
Write
Preview
Markdown
is supported
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