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
dbbaff18
Commit
dbbaff18
authored
9 years ago
by
Manuela Kuhn
Browse files
Options
Downloads
Patches
Plain Diff
Walk watchFolder default directories and add watch
parent
d6e5f2a2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conf/config.py
+1
-0
1 addition, 0 deletions
conf/config.py
src/ZeroMQTunnel/watcher.py
+17
-1
17 additions, 1 deletion
src/ZeroMQTunnel/watcher.py
with
18 additions
and
1 deletion
conf/config.py
+
1
−
0
View file @
dbbaff18
...
...
@@ -16,6 +16,7 @@ BASE_PATH = "/space/projects/live-viewer"
class
defaultConfigSender
():
# folder you want to monitor for changes
# inside this folder only the subdirectories "commissioning", "current" and "local" are monitored
watchFolder
=
BASE_PATH
+
"
/data/source/
"
# Target to move the files into
cleanerTargetPath
=
BASE_PATH
+
"
/data/target/
"
...
...
This diff is collapsed.
Click to expand it.
src/ZeroMQTunnel/watcher.py
+
17
−
1
View file @
dbbaff18
...
...
@@ -45,7 +45,7 @@ class DirectoryWatcher():
self
.
fileEventIp
=
fileEventIp
self
.
fileEventPort
=
fileEventPort
monitoredFolders
=
[
self
.
watchFolder
+
os
.
sep
+
folder
for
folder
in
self
.
monitoredDefaultSubfolders
]
monitoredFolders
=
self
.
getDirectoryStructure
()
self
.
eventDetector
=
EventDetector
(
monitoredFolders
)
assert
isinstance
(
self
.
zmqContext
,
zmq
.
sugar
.
context
.
Context
)
...
...
@@ -64,6 +64,22 @@ class DirectoryWatcher():
return
logger
def
getDirectoryStructure
(
self
):
# Add the default subfolders
foldersToWalk
=
[
self
.
watchFolder
+
os
.
sep
+
folder
for
folder
in
self
.
monitoredDefaultSubfolders
]
monitoredFolders
=
[]
# Walk the tree
for
folder
in
foldersToWalk
:
for
root
,
directories
,
files
in
os
.
walk
(
folder
):
# Add the found folders to the list for the inotify-watch
monitoredFolders
.
append
(
root
)
self
.
log
.
info
(
"
Add folder to monitor:
"
+
str
(
root
))
print
"
Add folder to monitor:
"
+
str
(
root
)
return
monitoredFolders
def
passFileToZeromq
(
self
,
targetSocket
,
sourcePath
,
relativePath
,
filename
):
'''
Taking the filename, creating a buffer and then
...
...
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