Teamcity timeout event handling

Hello,

I'm running python scripts by TeamCity, now timeout event is stopping script immediately, but I'd like to perform some steps after set time is elapsed. Is it any possibility to catch the trigger in Python? I tried with signal library:

class TeamCityTimeoutHander:
  def __init__(self):
    signal.signal(signal.SIGINT, self.stopExecution)
    signal.signal(signal.SIGTERM, self.stopExecution)

  def stopExecution(self):
    raise Exception("Test execution stopped by TeamCity Timeout")

 

but exception is not raised.

Do you have any ideas how to solve this issue?

Thanks,

Pawel

0
1 comment

Hi Pawel,

 

When a user requests to stop a build, the SIGTERM is first sent, as would be expected. Then if it does not respond for 60 seconds, it will send SIGKILL. This is what happens during a normal stop build procedure.

Which kind of build step are you running? What might be happening here is that the build runner is intercepting the signal first and reacting to it without letting it propagate.

0

Please sign in to leave a comment.