Skip to main content

No project description provided

Project description

GCS File Dependency Monitor is a Python library designed to wait for a specific file to appear in a Google Cloud Storage (GCS) bucket. If the file does not appear within a specified number of tries, it sends warning and error emails to a specified email address.

Features

  1. Monitors a GCS bucket for the presence of a specific file.
  2. Supports checking for files with names that include the current date.
  3. Sends warning emails after a certain number of unsuccessful tries.
  4. Sends an error email if the file does not appear after the maximum number of tries.
  5. Supports sending emails with optional attachments.

Requirements

  1. Python 3.x
  2. Google Cloud Storage client library
  3. smtplib for sending emails

Installation Install the package via pip:

pip install gcs-file-dependency-monitor

Dependencies

Make sure to have these installed using:

pip install google-cloud-storage
pip install datetime

Example Usage:

from gcs_file_dependency_monitor import gcs_file_dependency_monitor

gcs_file_dependency_monitor(
    dependent_file='path/to/your/file',
    dependent_file_bucket='your-bucket-name',
    number_of_tries=10,
    num_of_tries_before_warn_email=5,
    time_interval=60,
    warn_email_content='Warning: File not found yet.',
    warn_email_subject='File Not Found Warning',
    email_address='recipient@example.com',
    error_email_content='Error: File not found after maximum tries.',
    error_email_subject='File Not Found Error',
    SMTP_SERVER='smtp.example.com',
    SMTP_PORT=587,
    SMTP_USER='your-smtp-user',
    SMTP_PASSWORD='your-smtp-password',
    dependent_file_name_has_current_date=True
)

Parameters: gcs_file_dependency_monitor This function waits for a specific file to appear in a GCS bucket and sends emails based on the result.

Parameters:

  1. dependent_file (str): The file to wait for.
  2. dependent_file_bucket (str): The GCS bucket containing the file.
  3. number_of_tries (int): The number of attempts to check for the file.
  4. num_of_tries_before_warn_email (int): The number of tries before sending a warning email.
  5. time_interval (int): The time interval (in seconds) between attempts.
  6. warn_email_content (str): The content of the warning email.
  7. warn_email_subject (str): The subject of the warning email.
  8. email_address (str): The recipient email address.
  9. error_email_content (str): The content of the error email.
  10. error_email_subject (str): The subject of the error email.
  11. SMTP_SERVER (str): The SMTP server for sending emails.
  12. SMTP_PORT (int): The port for the SMTP server.
  13. SMTP_USER (str): The SMTP server user.
  14. SMTP_PASSWORD (str): The SMTP server password.
  15. dependent_file_name_has_current_date (bool, optional): Whether the dependent file name includes the current date. Default is False.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Gcs_file_dependency_monitor-0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file Gcs_file_dependency_monitor-0.1.tar.gz.

File metadata

File hashes

Hashes for Gcs_file_dependency_monitor-0.1.tar.gz
Algorithm Hash digest
SHA256 c94b7edfa7a3c0b6fb530b70d7de43ace87ce0a89374810c35589f4dc233ac9e
MD5 85800e8b0fbc8c5343ec7db983636d3d
BLAKE2b-256 378519e5e7b895cc11f613e8e7ea8586de848599df397febcedbcc166f813818

See more details on using hashes here.

File details

Details for the file Gcs_file_dependency_monitor-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Gcs_file_dependency_monitor-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe4e3931755649c9847820f7e725031a098faeef4405bc7984faf04feefc946
MD5 d9cb5d0fece8e690c2ffb7a2f4aa532e
BLAKE2b-256 090047ad7bc1b2bb38c12593ae9926ab421d632880d5ade02ad7f8007d8e001e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page