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
d187ec63
Commit
d187ec63
authored
3 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: do not directly load the model but use the insert_model module"
parent
0d20f45b
No related branches found
No related tags found
2 merge requests
!22
Release 0.3
,
!19
MAINT: further tests and docs
Pipeline
#14859
passed
3 years ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
integrationtests/insert_model.py
+25
-19
25 additions, 19 deletions
integrationtests/insert_model.py
integrationtests/test_crawl_with_datamodel_problems.py
+3
-2
3 additions, 2 deletions
integrationtests/test_crawl_with_datamodel_problems.py
with
28 additions
and
21 deletions
integrationtests/insert_model.py
+
25
−
19
View file @
d187ec63
...
@@ -5,22 +5,28 @@ from caosadvancedtools.cfoods.h5 import H5CFood
...
@@ -5,22 +5,28 @@ from caosadvancedtools.cfoods.h5 import H5CFood
from
caosadvancedtools.models.data_model
import
DataModel
from
caosadvancedtools.models.data_model
import
DataModel
from
caosadvancedtools.models.parser
import
parse_model_from_yaml
from
caosadvancedtools.models.parser
import
parse_model_from_yaml
# for teseting existing data model parts for the YANL Interface
db
.
RecordType
(
name
=
"
TestRT1
"
,
datatype
=
db
.
TEXT
).
insert
()
def
main
():
db
.
Property
(
name
=
"
TestP1
"
,
datatype
=
db
.
TEXT
).
insert
()
# for teseting existing data model parts for the YANL Interface
model
=
parse_model_from_yaml
(
"
model.yml
"
)
db
.
RecordType
(
name
=
"
TestRT1
"
,
datatype
=
db
.
TEXT
).
insert
()
model
.
sync_data_model
(
noquestion
=
True
)
db
.
Property
(
name
=
"
TestP1
"
,
datatype
=
db
.
TEXT
).
insert
()
if
len
(
db
.
execute_query
(
"
FIND Property alias
"
))
==
0
:
model
=
parse_model_from_yaml
(
"
model.yml
"
)
al
=
db
.
Property
(
name
=
"
alias
"
)
model
.
sync_data_model
(
noquestion
=
True
)
al
.
add_parent
(
name
=
"
name
"
)
al
.
insert
()
if
len
(
db
.
execute_query
(
"
FIND Property alias
"
))
==
0
:
al
=
db
.
Property
(
name
=
"
alias
"
)
h5model
=
db
.
Container
()
al
.
add_parent
(
name
=
"
name
"
)
h5file
=
h5py
.
File
(
'
extroot/ExperimentalData/2010_TestProject/2019-02-03/hdf5_dummy_file.hdf5
'
,
'
r
'
)
al
.
insert
()
H5CFood
.
create_structure
(
h5file
,
create_recordTypes
=
True
,
collection
=
h5model
,
root_name
=
"
ExampleH5
"
)
h5model
=
db
.
Container
()
print
(
h5model
)
h5file
=
h5py
.
File
(
'
extroot/ExperimentalData/2010_TestProject/2019-02-03/hdf5_dummy_file.hdf5
'
,
'
r
'
)
h5model
=
DataModel
(
h5model
)
H5CFood
.
create_structure
(
h5file
,
create_recordTypes
=
True
,
collection
=
h5model
,
h5model
.
sync_data_model
(
noquestion
=
True
)
root_name
=
"
ExampleH5
"
)
h5model
=
DataModel
(
h5model
)
h5model
.
sync_data_model
(
noquestion
=
True
)
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
integrationtests/test_crawl_with_datamodel_problems.py
+
3
−
2
View file @
d187ec63
...
@@ -34,6 +34,8 @@ from caosadvancedtools.models.parser import parse_model_from_yaml
...
@@ -34,6 +34,8 @@ from caosadvancedtools.models.parser import parse_model_from_yaml
from
caosadvancedtools.scifolder
import
(
AnalysisCFood
,
ExperimentCFood
,
from
caosadvancedtools.scifolder
import
(
AnalysisCFood
,
ExperimentCFood
,
PublicationCFood
,
SimulationCFood
)
PublicationCFood
,
SimulationCFood
)
from
insert_model
import
main
as
insert_model
def
setup_module
():
def
setup_module
():
"""
Clear problems and remove all entities except for built-in ones.
"""
"""
Clear problems and remove all entities except for built-in ones.
"""
...
@@ -67,8 +69,7 @@ def test_crawler_with_data_model_problems():
...
@@ -67,8 +69,7 @@ def test_crawler_with_data_model_problems():
prefix
=
""
,
dryrun
=
False
,
forceAllowSymlinks
=
False
)
prefix
=
""
,
dryrun
=
False
,
forceAllowSymlinks
=
False
)
# load and damage the model
# load and damage the model
model
=
parse_model_from_yaml
(
"
model.yml
"
)
insert_model
()
model
.
sync_data_model
(
noquestion
=
True
)
deleted_entities
=
{
"
Experiment
"
,
"
Poster
"
,
"
results
"
}
deleted_entities
=
{
"
Experiment
"
,
"
Poster
"
,
"
results
"
}
for
ent
in
deleted_entities
:
for
ent
in
deleted_entities
:
...
...
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