Skip to main content

A few ready-to use python tools for machine learning

Project description

FlashPythonToolbox

A few ready-to use python tools for machine learning

Install

pip install flashtool

Logger (to file)

For every print function, we print a copy to file without changing the whole file.

Logger(filepath = "./log.txt", mode = "w", stdout = None)
  • filepath: output path. Default: "./log.txt"
  • mode: write mode, e.g., w,w+,a,a+. Default: "w"
  • stdout: capture which print source. Default: "sys.stdout"

Example:

from flashtool import Logger
import sys
sys.stdout = Logger("path/to/log/file/log.txt")
sys.stdout = Logger("path/to/log/file/log.txt","w")
sys.stdout = Logger("path/to/log/file/log.txt","w", sys.stdout)

Email Module

Default Sender: gtflashauto@gmail.com. You need a password for this.

# Function api
def send_email(port = 587,password = None,
        sender_email = "gtflashauto@gmail.com",
        smtp_server="smtp.gmail.com",
        receiver_email = None,
        subject="Subject",
        message="Hello! "):
    ...

# Example
from flashtool import send_email
send_email(receiver_email="xxx@gmail.com", subject="Hi", message="first email")

Track Job

Track your job. Send you an email when it is done.

Tracking by PID Step 1: find your job pid by ps, e.g., ps aux | grep python Step 2:

from flashtool import trackpid
f(12345,5,"xxx@gmail.com")

API:

def trackpid(pid, checktime=1, receiver_email=None, sender_email="gtflashauto@gmail.com", msg=""):
  ...
  • checktime: check pid every checktime seconds
  • msg: additional message

Project details


Download files

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

Source Distribution

flashtool-0.0.4.tar.gz (3.0 kB view hashes)

Uploaded Source

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