Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
caosdb
Software
CaosDB Crawler
Commits
6fd897f7
Verified
Commit
6fd897f7
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
ENH: More caching
parent
aed9cfec
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!160
STY: styling
Pipeline
#47046
passed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/caoscrawler/identifiable_adapters.py
+4
-3
4 additions, 3 deletions
src/caoscrawler/identifiable_adapters.py
with
5 additions
and
3 deletions
CHANGELOG.md
+
1
−
0
View file @
6fd897f7
...
...
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
If a registered identifiable states, that a reference by a Record with parent
RT1 is needed, then now also references from Records that have a child of RT1
as parent are accepted.
-
More aggressive caching.
### Deprecated ###
...
...
This diff is collapsed.
Click to expand it.
src/caoscrawler/identifiable_adapters.py
+
4
−
3
View file @
6fd897f7
...
...
@@ -27,12 +27,13 @@ from __future__ import annotations
import
logging
from
abc
import
ABCMeta
,
abstractmethod
from
functools
import
lru_cache
from
datetime
import
datetime
from
typing
import
Any
import
caosdb
as
db
import
yaml
from
caosdb.cached
import
cached_get_entity_by
from
caosdb.cached
import
cached_get_entity_by
,
cached_query
from
.identifiable
import
Identifiable
from
.utils
import
has_parent
...
...
@@ -43,7 +44,7 @@ logger = logging.getLogger(__name__)
def
get_children_of_rt
(
rtname
):
"""
Supply the name of a recordtype. This name and the name of all children RTs are returned in
a list
"""
return
[
p
.
name
for
p
in
db
.
execute
_query
(
f
"
FIND RECORDTYPE
{
rtname
}
"
)]
return
[
p
.
name
for
p
in
cached
_query
(
f
"
FIND RECORDTYPE
{
rtname
}
"
)]
def
convert_value
(
value
:
Any
):
...
...
@@ -510,7 +511,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter):
def
retrieve_identified_record_for_identifiable
(
self
,
identifiable
:
Identifiable
):
query_string
=
self
.
create_query_for_identifiable
(
identifiable
)
candidates
=
db
.
execute
_query
(
query_string
)
candidates
=
cached
_query
(
query_string
)
if
len
(
candidates
)
>
1
:
raise
RuntimeError
(
f
"
Identifiable was not defined unambigiously.
\n
{
query_string
}
\n
Returned the
"
...
...
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