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
8aa81aad
Commit
8aa81aad
authored
4 years ago
by
Mussab Abdalla
Browse files
Options
Downloads
Patches
Plain Diff
using 2 saving functions
parent
9597fc08
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!55
Production release 1.2.0
,
!50
Ingestor status
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ingestor/Dockerfile
+1
-1
1 addition, 1 deletion
ingestor/Dockerfile
ingestor/app.py
+3
-3
3 additions, 3 deletions
ingestor/app.py
ingestor/filedaemon.py
+3
-3
3 additions, 3 deletions
ingestor/filedaemon.py
ingestor/ingestor/util.py
+9
-8
9 additions, 8 deletions
ingestor/ingestor/util.py
with
16 additions
and
15 deletions
ingestor/Dockerfile
+
1
−
1
View file @
8aa81aad
...
...
@@ -38,7 +38,7 @@ USER root
ADD
install.sh requirements.txt \
/
RUN
/install.sh
RUN
mkdir
/ingestor
RUN
mkdir
/ingestor
RUN
mkdir
-p
/var/ingestor/fail /var/ingestor/success
COPY
app.py config.py filedaemon.py /
COPY
ingestor/ /ingestor
...
...
This diff is collapsed.
Click to expand it.
ingestor/app.py
+
3
−
3
View file @
8aa81aad
...
...
@@ -35,7 +35,7 @@ from flask import Flask, request, Response
import
redis
from
ingestor.browse_report
import
parse_browse_report
from
ingestor.util
import
converter
,
save_report
,
browse_name
from
ingestor.util
import
converter
,
save_
endpoint_
report
,
browse_name
application
=
Flask
(
__name__
)
...
...
@@ -94,9 +94,9 @@ def ingest():
try
:
client
.
lpush
(
queue_name
,
queue_content
)
save_report
(
filename
,
request
.
data
,
True
)
save_
endpoint_
report
(
filename
,
request
.
data
,
True
)
return
Response
(
status
=
202
)
except
Exception
as
e
:
save_report
(
filename
,
request
.
data
,
False
)
save_
endpoint_
report
(
filename
,
request
.
data
,
False
)
return
Response
(
str
(
e
),
status
=
400
)
This diff is collapsed.
Click to expand it.
ingestor/filedaemon.py
+
3
−
3
View file @
8aa81aad
...
...
@@ -35,7 +35,7 @@ import pyinotify
import
redis
from
ingestor.browse_report
import
parse_browse_report
from
ingestor.util
import
converter
,
save_report
,
browse_name
from
ingestor.util
import
converter
,
save_
mount_
report
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -97,10 +97,10 @@ class EventHandler(pyinotify.ProcessEvent):
try
:
client
.
lpush
(
queue_name
,
queue_content
)
save_report
(
''
,
event
.
pathname
,
True
)
save_
mount_
report
(
event
.
pathname
,
True
)
except
Exception
as
e
:
save_report
(
''
,
event
.
pathname
,
False
)
save_
mount_
report
(
event
.
pathname
,
False
)
logger
.
exception
(
e
)
handler
=
EventHandler
()
...
...
This diff is collapsed.
Click to expand it.
ingestor/ingestor/util.py
+
9
−
8
View file @
8aa81aad
...
...
@@ -41,19 +41,20 @@ def converter(o):
if
isinstance
(
o
,
datetime
):
return
o
.
isoformat
()
def
save_report
(
filename
:
str
,
data
,
success
:
bool
):
def
save_mount_report
(
data
,
success
:
bool
):
if
success
:
save_dir
=
os
.
environ
[
'
INGESTOR_SUCCESS_DIR
'
]
else
:
save_dir
=
os
.
environ
[
'
INGESTOR_FAIL_DIR
'
]
shutil
.
move
(
data
,
save_dir
)
if
isinstance
(
data
,
str
):
shutil
.
move
(
data
,
save_dir
)
else
:
with
open
(
os
.
path
.
join
(
save_dir
,
'
%s.xml
'
%
filename
),
"
w
"
)
as
outfile
:
outfile
.
write
(
data
)
def
save_endpoint_report
(
filename
:
str
,
data
,
success
:
bool
):
if
success
:
save_dir
=
os
.
environ
[
'
INGESTOR_SUCCESS_DIR
'
]
else
:
save_dir
=
os
.
environ
[
'
INGESTOR_FAIL_DIR
'
]
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
"
])
\ No newline at end of file
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