EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository 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
ESA
PRISM
VS
Commits
7a28feef
Commit
7a28feef
authored
4 years ago
by
Lubomir Dolezal
Browse files
Options
Downloads
Plain Diff
Merge branch 'staging' into shib-configs-update
parents
87c5fa80
dc4def2f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!55
Production release 1.2.0
,
!54
Shib configs update
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ingestor/filedaemon.py
+9
-7
9 additions, 7 deletions
ingestor/filedaemon.py
ingestor/ingestor/util.py
+14
-9
14 additions, 9 deletions
ingestor/ingestor/util.py
with
23 additions
and
16 deletions
ingestor/filedaemon.py
+
9
−
7
View file @
7a28feef
#!/usr/bin/env python
#------------------------------------------------------------------------------
#
------------------------------------------------------------------------------
#
# Project: prism view server
# Authors: Fabian Schindler <fabian.schindler@eox.at>
#
#------------------------------------------------------------------------------
#
------------------------------------------------------------------------------
# Copyright (C) 2020 EOX IT Services GmbH <https://eox.at>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
...
...
@@ -24,7 +24,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#-----------------------------------------------------------------------------
#
-----------------------------------------------------------------------------
import
os
import
logging
...
...
@@ -80,11 +80,12 @@ client = redis.Redis(
watchmanager
=
pyinotify
.
WatchManager
()
class
EventHandler
(
pyinotify
.
ProcessEvent
):
def
process_IN_CLOSE_WRITE
(
self
,
event
):
logger
.
info
(
f
'
Parsing browse file:
{
event
.
pathname
}
'
)
try
:
try
:
with
open
(
event
.
pathname
)
as
f
:
browse_report
=
parse_browse_report
(
f
)
logger
.
debug
(
browse_report
)
...
...
@@ -95,15 +96,16 @@ class EventHandler(pyinotify.ProcessEvent):
queue_content
=
json
.
dumps
(
browse_report
,
default
=
converter
)
client
.
lpush
(
queue_name
,
queue_content
)
save_mount_report
(
event
.
pathname
,
True
)
except
Exception
as
e
:
save_mount_report
(
event
.
pathname
,
False
)
save_mount_report
(
event
.
pathname
,
False
)
logger
.
exception
(
e
)
handler
=
EventHandler
()
notifier
=
pyinotify
.
Notifier
(
watchmanager
,
handler
)
...
...
This diff is collapsed.
Click to expand it.
ingestor/ingestor/util.py
+
14
−
9
View file @
7a28feef
#------------------------------------------------------------------------------
#
------------------------------------------------------------------------------
#
# Project: prism view server
# Authors: Fabian Schindler <fabian.schindler@eox.at>
#
#------------------------------------------------------------------------------
#
------------------------------------------------------------------------------
# Copyright (C) 2020 EOX IT Services GmbH <https://eox.at>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
...
...
@@ -23,9 +23,8 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#-----------------------------------------------------------------------------
#
-----------------------------------------------------------------------------
import
json
import
os
import
shutil
from
datetime
import
datetime
...
...
@@ -41,20 +40,26 @@ def converter(o):
if
isinstance
(
o
,
datetime
):
return
o
.
isoformat
()
def
save_mount_report
(
data
,
success
:
bool
):
if
success
:
save_dir
=
os
.
environ
[
'
INGESTOR_SUCCESS_DIR
'
]
else
:
else
:
save_dir
=
os
.
environ
[
'
INGESTOR_FAIL_DIR
'
]
shutil
.
move
(
data
,
save_dir
)
shutil
.
copy
(
data
,
save_dir
)
os
.
remove
(
data
)
def
save_endpoint_report
(
filename
:
str
,
data
,
success
:
bool
):
if
success
:
save_dir
=
os
.
environ
[
'
INGESTOR_SUCCESS_DIR
'
]
else
:
else
:
save_dir
=
os
.
environ
[
'
INGESTOR_FAIL_DIR
'
]
with
open
(
os
.
path
.
join
(
save_dir
,
'
%s.xml
'
%
filename
),
"
w
"
)
as
outfile
:
outfile
.
write
(
data
)
with
open
(
os
.
path
.
join
(
save_dir
,
'
%s.xml
'
%
filename
),
"
w
"
)
as
outfile
:
outfile
.
write
(
data
)
def
browse_name
(
report
):
return
'
_
'
.
join
(
browse
[
"
browse_identifier
"
]
for
browse
in
report
[
"
browses
"
])
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