Below you can find my code when I use python logging handler to send some logs to my logstash server.
def tcp_logger():
file_logger = logging.getLogger()
if not any(
[
isinstance(handler, TCPLogstashHandler)
for handler in file_logger.handlers
]
):
host = os.environ.get('LOGSTASH_IP')
port = 5959
handle = TCPLogstashHandler(host, port)
file_logger.setLevel(<http://logging.INFO|logging.INFO>)
file_logger.addHandler(handle)
return file_logger
Task code:
from src.pubmed.logger import tcp_logger as get_logger
@task
def prepare_destination():
get_logger().info("starting prepare_destination")
files_path = prefect.context.get("pubmed_jsonl_local_path")
os.makedirs(files_path, exist_ok=True)
files_path = prefect.context.get("pubmed_xmls_local_path")
os.makedirs(files_path, exist_ok=True)
get_logger().info("ending prepare_destination")
return True
When I test my flow on a LocalExcecutor on my laptop and it logs
successfully with no error
But when I deploy my flow on my docker environment in the production server I get this error:
Failed to load and execute Flow's environment: FlowStorageError("An error occurred while unpickling the flow:\n TypeError('expected str, bytes or os.PathLike object, not NoneType')")