Skip to content

Commit

Permalink
Handle broken pipes when writing archive result. #1367
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeit-internet2 committed Feb 6, 2024
1 parent 509481f commit 221316b
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 14 deletions.
6 changes: 5 additions & 1 deletion pscheduler-archiver-bitbucket/bitbucket/archive
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER({"succeeded": True})
try:
EMITTER({"succeeded": True})
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
6 changes: 5 additions & 1 deletion pscheduler-archiver-esmond/esmond/archive
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
6 changes: 5 additions & 1 deletion pscheduler-archiver-failer/failer/archive
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ for parsed in PARSER:
if parsed["data"].get("badly", False):
pscheduler.fail("Forced to fail badly.")

EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
3 changes: 3 additions & 0 deletions pscheduler-archiver-http/http/archive
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ EMITTER = pscheduler.RFC7464Emitter(sys.stdout)
for parsed in PARSER:
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()
except Exception as ex:
log.exception()
EMITTER({
Expand Down
8 changes: 6 additions & 2 deletions pscheduler-archiver-kafka/kafka/archive
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
pscheduler.succeed()
6 changes: 5 additions & 1 deletion pscheduler-archiver-postgresql/postgresql/archive
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
6 changes: 5 additions & 1 deletion pscheduler-archiver-rabbitmq/rabbitmq/archive
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
6 changes: 5 additions & 1 deletion pscheduler-archiver-snmptrap/snmptrap/archive
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
6 changes: 5 additions & 1 deletion pscheduler-archiver-syslog/syslog/archive
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()
7 changes: 5 additions & 2 deletions pscheduler-archiver-tcp/tcp/archive
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()

7 changes: 5 additions & 2 deletions pscheduler-archiver-udp/udp/archive
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()

6 changes: 5 additions & 1 deletion scripts/PDK/templates/archiver/__PLUGIN_NAME__/archive
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ PARSER = pscheduler.RFC7464Parser(sys.stdin)
EMITTER = pscheduler.RFC7464Emitter(sys.stdout)

for parsed in PARSER:
EMITTER(archive(parsed))
try:
EMITTER(archive(parsed))
except BrokenPipeError as ex:
log.warning("Broken pipe during archiving; parent must have exited.")
pscheduler.succeed()

pscheduler.succeed()

0 comments on commit 221316b

Please sign in to comment.