Matt Alhonte
09/28/2024, 2:13 AMMarvin
09/28/2024, 2:14 AMINFO
level logs and above, but TensorFlow/Keras might be emitting at a different level (e.g., DEBUG
).
shell
prefect config set PREFECT_LOGGING_LEVEL=DEBUG
You can also set this in your environment:
shell
export PREFECT_LOGGING_LEVEL=DEBUG
2. Use get_run_logger
: Leverage Prefect's logging utility. Prefect provides a logger specific for flow runs that might help capture more context.
python
from prefect import flow, task
from prefect.logging import get_run_logger
@task
def train_model():
logger = get_run_logger()
# Your TensorFlow/Keras training logic here
<http://logger.info|logger.info>("Training started.")
# ...
@flow
def main_flow():
train_model()
if __name__ == "__main__":
main_flow()
3. Verify Cloud Configuration: Make sure your Prefect Cloud configuration is correct. Check your API keys and URLs.
shell
prefect config view
Ensure PREFECT_API_URL
is set to <https://api.prefect.cloud/api/>
and the PREFECT_API_KEY
is valid.
Sources:
- Prefect 2.x Logging Guide
- Prefect 2.x Troubleshooting
- Prefect 3.0 Logging Configuration
- Prefect 3.0 Troubleshooting Cloud
If you still face issues, consider checking both Prefect's and TensorFlow/Keras' documentation for logging compatibility and make sure there are no conflicts.