dbt-fal icon indicating copy to clipboard operation
dbt-fal copied to clipboard

unclosed ssl.SSLSocket warning when finishing a run

Open chamini2 opened this issue 2 years ago • 0 comments

Describe the bug I'm trying to set up a fal script to send a message to slack if a source fails a freshness test (using the functionality added in this PR, very exciting work btw!). I'm getting an issue with SSL sockets; details in thread. I'd appreciate any help, thanks!

sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=(...), raddr=(...)>

Your environment

  • OS: [TODO]
  • Paste the following commands output: [TODO]
fal --version
dbt --version
  • Adapter being used: [TODO]

How to reproduce [TODO]

Expected behavior No warning about unclosed sockets.

Additional context Script:

import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
from fal import FalDbt
from fal import DbtSource

CHANNEL_ID = os.getenv("SLACK_BOT_CHANNEL")
SLACK_TOKEN = os.getenv("SLACK_BOT_TOKEN")

client = WebClient(token=SLACK_TOKEN)
faldbt = FalDbt(project_dir='.', profiles_dir='.')

try:
    sources = faldbt.list_sources()
    for node in sources:
        if node.freshness and node.freshness.status != 'pass':
            freshness_message_text = f"Source: {node.name}.{node.table_name}, Status: {node.freshness.status}, Owner: <@will>"
            print(freshness_message_text)
            #response = client.chat_postMessage(
            #    channel=CHANNEL_ID,
            #    text=freshness_message_text
            #)

except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["error"]

Information being reported and updated from a thread in #tools-fal channel of dbt slack.

chamini2 avatar Jul 04 '22 15:07 chamini2