Skip to content

Commit

Permalink
Merge pull request #1101 from MetPX/issue1066
Browse files Browse the repository at this point in the history
only run after_post after we actually post
  • Loading branch information
petersilva authored Jun 6, 2024
2 parents cbfa0fe + d31c610 commit 590e591
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,23 +1211,26 @@ def work(self) -> None:

def post(self,now) -> None:

if len(self.plugins["post"]) > 0:
if hasattr(self.o,'post_broker') and self.o.post_broker:

# work-around for python3.5 not being able to copy re.match issue:
# https://github.com/MetPX/sarracenia/issues/857
if sys.version_info.major == 3 and sys.version_info.minor <= 6:
for m in self.worklist.ok:
if '_matches' in m:
del m['_matches']
if len(self.plugins["post"]) > 0:

for p in self.plugins["post"]:
try:
p(self.worklist)
except Exception as ex:
logger.error( f'flowCallback plugin {p} crashed: {ex}' )
logger.debug( "details:", exc_info=True )
# work-around for python3.5 not being able to copy re.match issue:
# https://github.com/MetPX/sarracenia/issues/857
if sys.version_info.major == 3 and sys.version_info.minor <= 6:
for m in self.worklist.ok:
if '_matches' in m:
del m['_matches']

for p in self.plugins["post"]:
try:
p(self.worklist)
except Exception as ex:
logger.error( f'flowCallback plugin {p} crashed: {ex}' )
logger.debug( "details:", exc_info=True )

self._runCallbacksWorklist('after_post')

self._runCallbacksWorklist('after_post')
self._runCallbacksWorklist('report')
self._runCallbackMetrics()

Expand Down

0 comments on commit 590e591

Please sign in to comment.