Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hidra
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
steinbac
hidra
Commits
9d2c6984
Commit
9d2c6984
authored
9 years ago
by
Manuela Kuhn
Browse files
Options
Downloads
Patches
Plain Diff
Added wrapper-script
parent
0a1c3ad2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lsyncd.conf
+31
-10
31 additions, 10 deletions
lsyncd.conf
wrapper_script.py
+38
-0
38 additions, 0 deletions
wrapper_script.py
with
69 additions
and
10 deletions
lsyncd.conf
+
31
−
10
View file @
9d2c6984
...
...
@@ -11,8 +11,9 @@
--
configuration
parameters
--
settings
{
statusFile
=
"/
var/log
/lsyncd.stat"
,
statusFile
=
"/
space/projects/Live_Viewer
/lsyncd.stat"
,
statusInterval
=
1
,
nodaemon
=
true
}
local
formats
= {
jpg
=
true
,
tif
=
true
,
cbf
=
true
,
log
=
true
}
...
...
@@ -44,12 +45,22 @@ gpfs = {
local
extension
=
string
.
match
(
event
.
name
,
".*%.([^.]+)$"
)
if
formats
[
extension
] ~=
true
then
return
end
spawn
(
spawn
(
event
,
'/bin/mv'
,
'/usr/bin/python'
,
'/space/projects/Live_Viewer/wrapper_script.py'
,
'--mv_source'
,
event
.
sourcePath
,
'--mv_target'
,
event
.
targetPathdir
)
--
spawn
(
--
event
,
--
'/bin/mv'
,
--
event
.
sourcePath
,
--
event
.
targetPathdir
-- )
end
end
,
...
...
@@ -71,12 +82,22 @@ gpfs = {
local
extension
=
string
.
match
(
event
.
name
,
".*%.([^.]+)$"
)
if
formats
[
extension
] ~=
true
then
return
end
spawn
(
spawn
(
event
,
'/bin/mv'
,
'/usr/bin/python'
,
'/space/projects/Live_Viewer/wrapper_script.py'
,
'--mv_source'
,
event
.
sourcePath
,
'--mv_target'
,
event
.
targetPathdir
)
--
spawn
(
--
event
,
--
'/bin/mv'
,
--
event
.
sourcePath
,
--
event
.
targetPathdir
-- )
end
end
,
...
...
@@ -89,8 +110,8 @@ gpfs = {
if
not
agent
.
isList
and
agent
.
etype
==
"Blanket"
then
if
exitcode
==
0
then
log
(
"Normal"
,
"Startup of '"
,
agent
.
source
,
"' finished."
)
elseif
config
.
exitcodes
and
config
.
exitcodes
[
exitcode
] ==
"again"
elseif
config
.
exitcodes
and
config
.
exitcodes
[
exitcode
] ==
"again"
then
log
(
"Normal"
,
"Retrying startup of '"
,
agent
.
source
,
"'."
)
return
"again"
...
...
@@ -100,7 +121,7 @@ gpfs = {
return
end
local
rc
=
config
.
exitcodes
and
config
.
exitcodes
[
exitcode
]
local
rc
=
config
.
exitcodes
and
config
.
exitcodes
[
exitcode
]
if
rc
==
"die"
then
return
rc
end
...
...
@@ -126,6 +147,6 @@ sync {
gpfs
,
delay
=
0
,
init
=
false
,
source
=
"/
rd
"
,
target
=
"/
gpfs
"
,
source
=
"/
space/projects/Live_Viewer/source
"
,
target
=
"/
space/projects/Live_Viewer/target
"
,
}
This diff is collapsed.
Click to expand it.
wrapper_script.py
0 → 100644
+
38
−
0
View file @
9d2c6984
import
argparse
import
subprocess
import
os
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--mv_source
"
,
help
=
"
Move source
"
)
parser
.
add_argument
(
"
--mv_target
"
,
help
=
"
Move target
"
)
arguments
=
parser
.
parse_args
()
source
=
arguments
.
mv_source
target
=
arguments
.
mv_target
watchFolder
=
"
/space/projects/Live_Viewer/source/
"
filepathNormalised
=
os
.
path
.
normpath
(
source
)
(
parentDir
,
filename
)
=
os
.
path
.
split
(
filepathNormalised
)
commonPrefix
=
os
.
path
.
commonprefix
(
[
watchFolder
,
filepathNormalised
]
)
#print "commonPrefix", commonPrefix
relativeBasepath
=
os
.
path
.
relpath
(
filepathNormalised
,
commonPrefix
)
#print "relativeBasepath", relativeBasepath
(
relativeParent
,
blub
)
=
os
.
path
.
split
(
relativeBasepath
)
print
"
filename
"
,
filename
print
"
parentDir
"
,
parentDir
print
"
relativeParent
"
,
relativeParent
my_cmd
=
'
echo
"'
+
arguments
.
mv_source
+
'"
> /tmp/zeromqllpipe
'
print
my_cmd
p
=
subprocess
.
Popen
(
my_cmd
,
shell
=
True
)
p
.
communicate
()
p
=
subprocess
.
Popen
(
[
'
mv
'
,
arguments
.
mv_source
,
arguments
.
mv_target
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
False
)
out
,
err
=
p
.
communicate
()
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