Skip to content
Snippets Groups Projects
Commit 651d64c1 authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

Notify worker if FileMover exits

parent 42176580
No related branches found
No related tags found
No related merge requests found
......@@ -344,6 +344,7 @@ class FileMover():
self.log.debug("Closing sockets")
self.fileEventSocket.close(0)
self.receiverComSocket.close(0)
self.sendSignalToWorker("EXIT")
self.routerSocket.close(0)
......@@ -152,10 +152,7 @@ class WorkerProcess():
will be removed.
"""
processingJobs = True
jobCount = 0
while processingJobs:
while True:
#sending a "ready"-signal to the router.
#the reply will contain the actual job/task.
self.log.debug("worker-"+str(self.id)+": sending ready signal")
......@@ -164,16 +161,14 @@ class WorkerProcess():
# Get workload from router, until finished
self.log.debug("worker-"+str(self.id)+": waiting for new job")
self.log.debug("worker-" + str(self.id) + ": waiting for new job")
workload = self.routerSocket.recv()
self.log.debug("worker-"+str(self.id)+": new job received")
self.log.debug("worker-" + str(self.id) + ": new job received")
finished = workload == b"END"
finished = workload == b"EXIT"
if finished:
processingJobs = False
self.log.debug("router requested to shutdown worker-process. Worker processed: %d files" % jobCount)
self.log.debug("Router requested to shutdown worker-"+ str(self.id) + ".")
break
jobCount += 1
# after the signal processing
......@@ -181,7 +176,6 @@ class WorkerProcess():
continue
# get metadata of the file
if self.useDataStream or self.openConnections["streams"] or self.openConnections["queryNext"] or self.openConnections["OnDA"]:
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment