Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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-advanced-user-tools
Commits
709794f4
Commit
709794f4
authored
5 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: fix test, allow non-interactive crawl, and docs
parent
82755021
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
integrationtests/full_test/test_crawler.py
+2
-2
2 additions, 2 deletions
integrationtests/full_test/test_crawler.py
src/caosadvancedtools/cfood.py
+29
-1
29 additions, 1 deletion
src/caosadvancedtools/cfood.py
with
31 additions
and
3 deletions
integrationtests/full_test/test_crawler.py
+
2
−
2
View file @
709794f4
...
@@ -18,7 +18,7 @@ class CrawlerTest(unittest.TestCase):
...
@@ -18,7 +18,7 @@ class CrawlerTest(unittest.TestCase):
# vanishing of the property
# vanishing of the property
# thus an x is used here. Needs to be fixed.
# thus an x is used here. Needs to be fixed.
exp
=
db
.
execute_query
(
exp
=
db
.
execute_query
(
"
FIND Experiment with date=2019-02-03 and
not
identifier
"
,
"
FIND Experiment with date=2019-02-03 and
identifier=empty_
identifier
"
,
unique
=
True
)
unique
=
True
)
# There should be a Project with name TestProject which is referenced
# There should be a Project with name TestProject which is referenced
...
@@ -57,7 +57,7 @@ class CrawlerTest(unittest.TestCase):
...
@@ -57,7 +57,7 @@ class CrawlerTest(unittest.TestCase):
# # first analysis # #
# # first analysis # #
######################
######################
ana
=
db
.
execute_query
(
ana
=
db
.
execute_query
(
"
FIND Analysis with date=2019-02-03 and identifier=
'
x
'"
,
"
FIND Analysis with date=2019-02-03 and identifier=
'
empty_identifier
'"
,
unique
=
True
)
unique
=
True
)
# There should be a Project with name TestProject which is referenced
# There should be a Project with name TestProject which is referenced
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/cfood.py
+
29
−
1
View file @
709794f4
...
@@ -175,7 +175,14 @@ class AbstractCFood(object):
...
@@ -175,7 +175,14 @@ class AbstractCFood(object):
def
looking_for
(
self
,
crawled_file
):
def
looking_for
(
self
,
crawled_file
):
"""
"""
should set the instance variable Container with the identifiables
returns True if crawled_file can be added this CFood.
to be overwritten by subclasses.
Sometimes files belong to the CFood of created by another file. This
function can be used to define what files shall be
'
attached
'
. E.g. the
data from an experiment should always contain a labnotes scan. Then a
subclass CFood for the experiment could be
'
looking_for
'
this scan
using this function.
"""
"""
return
False
return
False
...
@@ -412,6 +419,27 @@ def get_ids_for_entities_with_names(entities):
...
@@ -412,6 +419,27 @@ def get_ids_for_entities_with_names(entities):
class
CMeal
(
object
):
class
CMeal
(
object
):
"""
CMeal groups equivalent CFoods and allow their collected insertion.
Sometimes there is no one file that can be used to trigger the creation of
some Record. E.g. if a collection of images shall be referenced from one
Record that groups them, it is unclear which image should trigger the
creation of the Record.
CMeals are grouped based on the groups in the used regular expression. If,
in the above example, all the images reside in one folder, all groups
except that for the file name should match. The groups that shall match
need to be listed in the matching_groups class property. Subclasses will
overwrite this property.
The cook function of a cfood allows this class to work. Instead of directly
instantiating a CFood the cook function is used. If the CFood is also a
child of CMeal, it will be checked (using get_suitable_cfood) in the cook
function whether a new CFood should be created or if the file match should
be added to an existing one. In order to allow this all instances of a
CFood class are tracked in the existing_instances class member.
"""
existing_instances
=
[]
existing_instances
=
[]
matching_groups
=
[]
matching_groups
=
[]
...
...
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