def METHOD_NAME(func):
    def decorated_func(*args, **kwargs):
        global routine_loop
        while routine_loop:
            try:
                func(*args, **kwargs)
            except (JrdsAuthorizationException,
                    JrdsSandboxTerminated,
                    InvalidFilePermissionException,
                    FileNotFoundException,
                    Exception):
                stack = traceback.format_exc()
                tracer.log_sandbox_safe_loop_terminal_exception(stack)
                sys.stderr.write(stack) # writing exception to stderr to be traced by the worker
                sys.stderr.flush()
                time.sleep(1)  # allow the trace to make it to stdout (since traces are background threads)
                # this will work as long as all threads are daemon
                # daemon threads are only supported in 2.6+
                sys.exit(1)
            time.sleep(configuration.get_jrds_get_job_actions_polling_freq())
    return decorated_func