Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dm-docs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hammonds
dm-docs
Commits
616575be
Commit
616575be
authored
6 years ago
by
sveseli
Browse files
Options
Downloads
Patches
Plain Diff
fix bug with unchecked metadata additions
parent
fe1131fa
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python/dm/common/processing/plugins/mongoDbFileCatalogPlugin.py
+15
-10
15 additions, 10 deletions
.../dm/common/processing/plugins/mongoDbFileCatalogPlugin.py
with
15 additions
and
10 deletions
src/python/dm/common/processing/plugins/mongoDbFileCatalogPlugin.py
+
15
−
10
View file @
616575be
...
...
@@ -63,8 +63,8 @@ class MongoDbFileCatalogPlugin(FileProcessor):
self
.
logger
.
debug
(
'
Before releasing Mongo DB API instance semaphore count is %s
'
%
(
self
.
mongoApiSemaphore
.
__dict__
.
get
(
'
_Semaphore__value
'
)))
self
.
mongoApiSemaphore
.
release
()
def
getInitialCollectionSize
(
self
,
fileMongoDbApi
,
experimentName
,
upload
OrDaq
Id
):
key
=
'
%s-%s
'
%
(
experimentName
,
upload
OrDaq
Id
)
def
getInitialCollectionSize
(
self
,
fileMongoDbApi
,
experimentName
,
uploadId
):
key
=
'
%s-%s
'
%
(
experimentName
,
uploadId
)
self
.
lock
.
acquire
()
try
:
nFiles
=
self
.
initialCollectionSizeMap
.
get
(
key
)
...
...
@@ -78,35 +78,35 @@ class MongoDbFileCatalogPlugin(FileProcessor):
def
processFile
(
self
,
fileInfo
):
experimentFilePath
=
fileInfo
.
get
(
'
experimentFilePath
'
)
experimentName
=
fileInfo
.
get
(
'
experimentName
'
)
upload
OrDaq
Id
=
fileInfo
.
get
(
'
uploadId
'
)
or
fileInfo
.
get
(
'
daqId
'
)
uploadId
=
fileInfo
.
get
(
'
uploadId
'
)
self
.
logger
.
debug
(
'
Processing file
"
%s
"
for experiment %s
'
%
(
experimentFilePath
,
experimentName
))
fileMetadata
=
self
.
metadataCollector
.
processMetadata
(
fileInfo
,
self
.
statUtility
)
self
.
logger
.
debug
(
'
File
"
%s
"
catalog entry: %s
'
%
(
experimentFilePath
,
str
(
fileMetadata
)))
fileInfo
[
'
metadata
'
]
=
fileMetadata
fileMongoDbApi
=
self
.
acquireMongoApi
()
if
self
.
getInitialCollectionSize
(
fileMongoDbApi
,
experimentName
,
upload
OrDaq
Id
)
==
0
:
self
.
logger
.
debug
(
'
Initial collection size is zero, adding file %s
'
%
(
experimentFilePath
))
if
uploadId
and
self
.
getInitialCollectionSize
(
fileMongoDbApi
,
experimentName
,
uploadId
)
==
0
:
self
.
logger
.
debug
(
'
Initial collection size is zero
for upload %s
, adding file %s
'
%
(
uploadId
,
experimentFilePath
))
fileMongoDbApi
.
addExperimentFileUnchecked
(
fileMetadata
)
else
:
self
.
logger
.
debug
(
'
Initial collection size is not zero, u
pdating file %s
'
%
(
experimentFilePath
))
self
.
logger
.
debug
(
'
U
pdating file %s
'
%
(
experimentFilePath
))
fileMongoDbApi
.
updateOrAddExperimentFile
(
fileMetadata
)
self
.
releaseMongoApi
(
fileMongoDbApi
)
def
processFile2
(
self
,
fileInfo
,
fileMongoDbApi
):
experimentFilePath
=
fileInfo
.
get
(
'
experimentFilePath
'
)
experimentName
=
fileInfo
.
get
(
'
experimentName
'
)
upload
OrDaq
Id
=
fileInfo
.
get
(
'
uploadId
'
)
or
fileInfo
.
get
(
'
daqId
'
)
uploadId
=
fileInfo
.
get
(
'
uploadId
'
)
self
.
logger
.
debug
(
'
Processing file
"
%s
"
for experiment %s
'
%
(
experimentFilePath
,
experimentName
))
fileMetadata
=
self
.
metadataCollector
.
processMetadata
(
fileInfo
,
self
.
statUtility
)
self
.
logger
.
debug
(
'
File
"
%s
"
catalog entry: %s
'
%
(
experimentFilePath
,
str
(
fileMetadata
)))
fileInfo
[
'
metadata
'
]
=
fileMetadata
if
self
.
getInitialCollectionSize
(
fileMongoDbApi
,
experimentName
,
upload
OrDaq
Id
)
==
0
:
self
.
logger
.
debug
(
'
Initial collection size is zero, adding file %s
'
%
(
experimentFilePath
))
if
uploadId
and
self
.
getInitialCollectionSize
(
fileMongoDbApi
,
experimentName
,
uploadId
)
==
0
:
self
.
logger
.
debug
(
'
Initial collection size is zero
for upload %s
, adding file %s
'
%
(
uploadId
,
experimentFilePath
))
fileMongoDbApi
.
addExperimentFileUnchecked
(
fileMetadata
)
else
:
self
.
logger
.
debug
(
'
Initial collection size is not zero, u
pdating file %s
'
%
(
experimentFilePath
))
self
.
logger
.
debug
(
'
U
pdating file %s
'
%
(
experimentFilePath
))
fileMongoDbApi
.
updateOrAddExperimentFile
(
fileMetadata
)
def
processFilePath
(
self
,
fileMongoDbApi
,
filePath
,
filePathDict
,
experiment
,
dataDirectory
,
destDirectory
,
daqInfo
,
uploadId
,
processDirectoryInfo
):
...
...
@@ -162,3 +162,8 @@ class MongoDbFileCatalogPlugin(FileProcessor):
processingTimer
=
threading
.
Timer
(
self
.
PROCESSING_TIMER_DELAY_PERIOD
,
self
.
processFilePath
,
args
=
[
fileMongoDbApi
,
filePath
,
filePathDict
,
experiment
,
dataDirectory
,
destDirectory
,
daqInfo
,
uploadId
,
processDirectoryInfo
])
processingTimer
.
start
()
#######################################################################
# Testing.
if
__name__
==
'
__main__
'
:
pass
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