Closed orn688 closed 6 years ago
Hi @orn688, thank you for submitting the PR!
Btw what was the exception that you encountered in Python 3 that had no argument?
@zezha-msft I'm using Celery's soft time limits. When the soft time limit for a task is exceeded, Celery raises a SoftTimeLimitExceeded()
exception with no arguments.
Hi @orn688, thanks for the explanation! I'm still a bit confused, how did the exception SoftTimeLimitExceeded
get thrown inside the SDK's executor?
Could you please rebase your branch on the dev branch? Thank you!!
@zezha-msft Sure! Celery forks a worker process that uses signal.signal()
to raise the exception when it receives a certain signal from another process alerting that it has exceeded its soft time limit. See: https://github.com/celery/billiard/blob/master/billiard/pool.py#L226
There has been some some discussion about changing the SoftTimeLimitExceeded
exception to not inherit from Exception
, which would solve the immediate issue, but it doesn't seem to have much traction and I figured that since you were checking len(exc.args)
anyway for Python 2, it made sense to do it for Python 3 as well.
If an exception without any arguments was raised during a request, an
IndexError
would be raised whenexc.args[0]
was executed under Python 3. This moves the check to make sure thatexc.args
is not empty so that it executes under both Python 2 and Python 3.