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
cb1aea66
Commit
cb1aea66
authored
9 years ago
by
Manuela Kuhn
Browse files
Options
Downloads
Patches
Plain Diff
Only files with a specific extention are send to the ring buffer
parent
fb541371
No related branches found
Branches containing commit
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
wrapper_script.py
+45
-18
45 additions, 18 deletions
wrapper_script.py
with
45 additions
and
18 deletions
wrapper_script.py
+
45
−
18
View file @
cb1aea66
import
argparse
import
subprocess
import
os
import
time
supportedFormats
=
[
"
tif
"
,
"
cbf
"
,
"
hdf5
"
]
watchFolder
=
"
/space/projects/Live_Viewer/source/
"
parser
=
argparse
.
ArgumentParser
()
...
...
@@ -9,29 +14,51 @@ parser.add_argument("--mv_target", help = "Move target")
arguments
=
parser
.
parse_args
()
source
=
arguments
.
mv_source
target
=
arguments
.
mv_target
source
=
os
.
path
.
normpath
(
arguments
.
mv_source
)
target
=
os
.
path
.
normpath
(
arguments
.
mv_target
)
watchFolder
=
"
/space/projects/Live_Viewer/source/
"
(
parentDir
,
filename
)
=
os
.
path
.
split
(
source
)
commonPrefix
=
os
.
path
.
commonprefix
(
[
watchFolder
,
source
]
)
relativebasepath
=
os
.
path
.
relpath
(
source
,
commonPrefix
)
(
relativeParent
,
blub
)
=
os
.
path
.
split
(
relativebasepath
)
(
name
,
postfix
)
=
filename
.
split
(
"
.
"
)
supported_file
=
postfix
in
supportedFormats
if
supported_File
:
my_cmd
=
'
echo
"'
+
source
+
'"
> /tmp/zeromqllpipe
'
p
=
subprocess
.
Popen
(
my_cmd
,
shell
=
True
)
p
.
communicate
()
# wait to ZeroMQ to finish
time
.
sleep
(
5
)
# get responce from zeromq
#pipe_path = "/tmp/zeromqllpipe_resp"
# Open the fifo. We need to open in non-blocking mode or it will stalls until
# someone opens it for writting
#pipe_fd = os.open(pipe_path, os.O_RDONLY | os.O_NONBLOCK)
#waitForAnswer = True
#wait for new files
#with os.fdopen(pipe_fd) as pipe:
# while waitForAnswer:
# message = pipe.read()
# if message:
# pathnames = message.splitlines()
# for filepath in pathnames:
# if filepath == source:
# waitForAnswer = False
# break
# print "sleep"
# time.sleep(0.1)
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
],
p
=
subprocess
.
Popen
(
[
'
mv
'
,
source
,
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