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
acccecab
Commit
acccecab
authored
9 years ago
by
Manuela Kuhn
Browse files
Options
Downloads
Patches
Plain Diff
Added senderComIp and Exceptions for socket-creation
parent
83b2858c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conf/receiverLiveViewer.conf
+2
-0
2 additions, 0 deletions
conf/receiverLiveViewer.conf
src/receiver_LiveViewer.py
+10
-2
10 additions, 2 deletions
src/receiver_LiveViewer.py
src/receiver_LiveViewer/FileReceiver.py
+27
-12
27 additions, 12 deletions
src/receiver_LiveViewer/FileReceiver.py
with
39 additions
and
14 deletions
conf/receiverLiveViewer.conf
+
2
−
0
View file @
acccecab
...
...
@@ -14,6 +14,8 @@ liveViewerPort = 50021
# Port to exchange data and signals between receiver and coordinator
coordinatorExchangePort
=
50020
# IP of dataStream-socket to send signals back to the sender
senderComIp
=
lsdma
-
lab04
.
desy
.
de
# Port number of dataStream-socket to send signals back to the sender
senderComPort
=
50000
# Time to wait for the sender to give a confirmation of the signal
...
...
This diff is collapsed.
Click to expand it.
src/receiver_LiveViewer.py
+
10
−
2
View file @
acccecab
...
...
@@ -30,6 +30,7 @@ def argumentParsing():
liveViewerIp
=
config
.
get
(
'
asection
'
,
'
liveViewerIp
'
)
liveViewerPort
=
config
.
get
(
'
asection
'
,
'
liveViewerPort
'
)
coordinatorExchangePort
=
config
.
get
(
'
asection
'
,
'
coordinatorExchangePort
'
)
senderComIp
=
config
.
get
(
'
asection
'
,
'
senderComIp
'
)
senderComPort
=
config
.
get
(
'
asection
'
,
'
senderComPort
'
)
maxRingBufferSize
=
config
.
get
(
'
asection
'
,
'
maxRingBufferSize
'
)
senderResponseTimeout
=
config
.
get
(
'
asection
'
,
'
senderResponseTimeout
'
)
...
...
@@ -53,6 +54,8 @@ def argumentParsing():
help
=
"
tcp port of live viewer (default=
"
+
str
(
liveViewerPort
)
+
"
)
"
)
parser
.
add_argument
(
"
--coordinatorExchangePort
"
,
type
=
str
,
default
=
coordinatorExchangePort
,
help
=
"
port to exchange data and signals between receiver and coordinato (default=
"
+
str
(
coordinatorExchangePort
)
+
"
)
"
)
parser
.
add_argument
(
"
--senderComIp
"
,
type
=
str
,
default
=
senderComIp
,
help
=
"
port number of dataStream-socket to send signals back to the sender (default=
"
+
str
(
senderComIp
)
+
"
)
"
)
parser
.
add_argument
(
"
--senderComPort
"
,
type
=
str
,
default
=
senderComPort
,
help
=
"
port number of dataStream-socket to send signals back to the sender (default=
"
+
str
(
senderComPort
)
+
"
)
"
)
parser
.
add_argument
(
"
--maxRingBufferSize
"
,
type
=
int
,
default
=
maxRingBufferSize
,
...
...
@@ -90,6 +93,7 @@ class ReceiverLiveViewer():
liveViewerIp
=
None
liveViewerPort
=
None
coordinatorExchangePort
=
None
senderComIp
=
None
senderComPort
=
None
maxRingBufferSize
=
None
senderResponseTimeout
=
None
...
...
@@ -109,6 +113,7 @@ class ReceiverLiveViewer():
self
.
liveViewerIp
=
arguments
.
liveViewerIp
self
.
liveViewerPort
=
arguments
.
liveViewerPort
self
.
coordinatorExchangePort
=
arguments
.
coordinatorExchangePort
self
.
senderComIp
=
arguments
.
senderComIp
self
.
senderComPort
=
arguments
.
senderComPort
self
.
maxRingBufferSize
=
arguments
.
maxRingBufferSize
self
.
senderResponseTimeout
=
arguments
.
senderResponseTimeout
...
...
@@ -119,8 +124,11 @@ class ReceiverLiveViewer():
#start file receiver
myWorker
=
FileReceiver
(
self
.
targetDir
,
self
.
dataStreamIp
,
self
.
dataStreamPort
,
self
.
liveViewerPort
,
self
.
liveViewerIp
,
self
.
coordinatorExchangePort
,
self
.
senderComPort
,
self
.
maxRingBufferSize
,
self
.
senderResponseTimeout
)
myWorker
=
FileReceiver
(
self
.
targetDir
,
self
.
senderComIp
,
self
.
senderComPort
,
self
.
dataStreamIp
,
self
.
dataStreamPort
,
self
.
liveViewerPort
,
self
.
liveViewerIp
,
self
.
coordinatorExchangePort
,
self
.
maxRingBufferSize
,
self
.
senderResponseTimeout
)
if
__name__
==
"
__main__
"
:
receiver
=
ReceiverLiveViewer
()
This diff is collapsed.
Click to expand it.
src/receiver_LiveViewer/FileReceiver.py
+
27
−
12
View file @
acccecab
...
...
@@ -26,8 +26,8 @@ class FileReceiver:
liveViewerPort
=
None
coordinatorExchangeIp
=
None
coordinatorExchangePort
=
None
senderComIp
=
None
# ip for socket to communicate with
receiv
er
senderComPort
=
None
# port for socket to communicate
receiv
er
senderComIp
=
None
# ip for socket to communicate with
the send
er
senderComPort
=
None
# port for socket to communicate
with the send
er
socketResponseTimeout
=
None
# time in milliseconds to wait for the sender to answer to a signal
log
=
None
...
...
@@ -41,9 +41,12 @@ class FileReceiver:
# print socket.gethostbyname(socket.gethostname())
def
__init__
(
self
,
outputDir
,
dataStreamIp
,
dataStreamPort
,
liveViewerPort
,
liveViewerIp
,
coordinatorExchangePort
,
senderComPort
,
maxRingBuffersize
,
senderResponseTimeout
=
1000
,
context
=
None
):
def
__init__
(
self
,
outputDir
,
senderComIp
,
senderComPort
,
dataStreamIp
,
dataStreamPort
,
liveViewerPort
,
liveViewerIp
,
coordinatorExchangePort
,
maxRingBuffersize
,
senderResponseTimeout
=
1000
,
context
=
None
):
self
.
outputDir
=
os
.
path
.
normpath
(
outputDir
)
self
.
dataStreamIp
=
dataStreamIp
...
...
@@ -52,7 +55,7 @@ class FileReceiver:
self
.
liveViewerPort
=
liveViewerPort
self
.
coordinatorExchangeIp
=
"
127.0.0.1
"
self
.
coordinatorExchangePort
=
coordinatorExchangePort
self
.
senderComIp
=
dataStreamIp
# ip for socket to communicate with sender; is the same ip as the data stream i
p
self
.
senderComIp
=
senderComI
p
self
.
senderComPort
=
senderComPort
self
.
socketResponseTimeout
=
senderResponseTimeout
...
...
@@ -135,8 +138,12 @@ class FileReceiver:
# time to wait for the sender to give a confirmation of the signal
# self.senderComSocket.RCVTIMEO = self.socketResponseTimeout
connectionStr
=
"
tcp://{ip}:{port}
"
.
format
(
ip
=
self
.
senderComIp
,
port
=
self
.
senderComPort
)
self
.
senderComSocket
.
connect
(
connectionStr
)
self
.
log
.
info
(
"
senderComSocket started (connect) for
'"
+
connectionStr
+
"'"
)
try
:
self
.
senderComSocket
.
connect
(
connectionStr
)
self
.
log
.
info
(
"
senderComSocket started (connect) for
'"
+
connectionStr
+
"'"
)
except
Exception
as
e
:
self
.
log
.
error
(
"
Failed to start senderComSocket (connect):
'"
+
connectionStr
+
"'"
)
self
.
log
.
debug
(
"
Error was:
"
+
str
(
e
))
# using a Poller to implement the senderComSocket timeout (in older ZMQ version there is no option RCVTIMEO)
self
.
poller
=
zmq
.
Poller
()
...
...
@@ -145,14 +152,22 @@ class FileReceiver:
# create socket to communicate with Coordinator
self
.
coordinatorExchangeSocket
=
self
.
zmqContext
.
socket
(
zmq
.
PAIR
)
connectionStr
=
"
tcp://{ip}:{port}
"
.
format
(
ip
=
self
.
coordinatorExchangeIp
,
port
=
self
.
coordinatorExchangePort
)
self
.
coordinatorExchangeSocket
.
connect
(
connectionStr
)
self
.
log
.
debug
(
"
coordinatorExchangeSocket started (connect) for
'"
+
connectionStr
+
"'"
)
try
:
self
.
coordinatorExchangeSocket
.
connect
(
connectionStr
)
self
.
log
.
debug
(
"
coordinatorExchangeSocket started (connect) for
'"
+
connectionStr
+
"'"
)
except
Exception
as
e
:
self
.
log
.
error
(
"
Failed to start coordinatorExchangeSocket (connect):
'"
+
connectionStr
+
"'"
)
self
.
log
.
debug
(
"
Error was:
"
+
str
(
e
))
# create sockets to retrieve data from Sender
self
.
dataStreamSocket
=
self
.
zmqContext
.
socket
(
zmq
.
PULL
)
connectionStr
=
"
tcp://{ip}:{port}
"
.
format
(
ip
=
self
.
dataStreamIp
,
port
=
self
.
dataStreamPort
)
self
.
dataStreamSocket
.
bind
(
connectionStr
)
self
.
log
.
info
(
"
dataStreamSocket started (bind) for
'"
+
connectionStr
+
"'"
)
try
:
self
.
dataStreamSocket
.
bind
(
connectionStr
)
self
.
log
.
info
(
"
dataStreamSocket started (bind) for
'"
+
connectionStr
+
"'"
)
except
Exception
as
e
:
self
.
log
.
error
(
"
Failed to start dataStreamSocket (bind):
'"
+
connectionStr
+
"'"
)
self
.
log
.
debug
(
"
Error was:
"
+
str
(
e
))
def
startReceiving
(
self
):
...
...
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