Suppress warning message (set environment variable) in Foundry Repositories debugging mode

363 Views Asked by At

Trying to debug repository code, I have set the breakpoint and run the transformation. Then, in the debugging console I get this warning:

df.show(1)
 Evaluating: df.show(1) did not finish after 3.00 seconds.
This may mean a number of things:
- This evaluation is really slow and this is expected.
    In this case it's possible to silence this error by raising the timeout, setting the
    PYDEVD_WARN_EVALUATION_TIMEOUT environment variable to a bigger value.

- The evaluation may need other threads running while it's running:
    In this case, it's possible to set the PYDEVD_UNBLOCK_THREADS_TIMEOUT
    environment variable so that if after a given timeout an evaluation doesn't finish,
    other threads are unblocked or you can manually resume all threads.

    Alternatively, it's also possible to skip breaking on a particular thread by setting a
    `pydev_do_not_trace = True` attribute in the related threading.Thread instance
    (if some thread should always be running and no breakpoints are expected to be hit in it).

- The evaluation is deadlocked:
    In this case you may set the PYDEVD_THREAD_DUMP_ON_WARN_EVALUATION_TIMEOUT
    environment variable to true so that a thread dump is shown along with this message and
    optionally, set the PYDEVD_INTERRUPT_THREAD_TIMEOUT to some value so that the debugger
    tries to interrupt the evaluation (if possible) when this happens.

In my case, it's the 1st option, as I get the result after a moment of waiting. So, I want to silence the warning. I have unsuccessfully tried:

import os
os.environ["PYDEVD_WARN_EVALUATION_TIMEOUT"] = '90000000000000'

How to suppress the warning message?

1

There are 1 best solutions below

1
Ontologize On

Are you referring to (a) not being able to set the env var, or (b) successfully setting the env var but that not resolving the timeout issue?

In the event it's (a), here's what works for me (based off the default examples.py created when you make a new repo). I added logging to check that PYDEVD_WARN_EVALUATION_TIMEOUT was set. In debugging mode, I can see that it's set in the os.environ dict.

import os
from transforms.api import transform_df, Input, Output
from myproject.datasets import utils

import logging

logger = logging.getLogger(__name__)

@transform_df(
    Output("/path/to/output/dataset"),
    source_df=Input("/path/to/input/dataset"),
)
def compute(source_df):
    os.environ["PYDEVD_WARN_EVALUATION_TIMEOUT"] = '900000'
    logger.info(os.environ["PYDEVD_WARN_EVALUATION_TIMEOUT"])
    return utils.identity(source_df)