Skip to main content

Notify via E-mail or Slack Incoming Webhooks when command ends or runs into error.

Project description

Lookout: Command watcher w/ Slack

example image

About

Lookout is a simple yet powerful CLI app that sends a slack notification when your program

  1. completes successfully,
  2. terminates with an error,
  3. exceeds predefined time without any output, or
  4. outputs predefined regex match.

Usage is very simple as well; say you wanted to run:

$ python really_heavy_program.py arg1 arg2

With lookout, just do:

$ lookout python really_heavy_program.py arg1 arg2

Example usages:

  • Waiting for installation (or worse yet, conda's infamous Solving environment: \)
    $ lookout --regex "\(\[y\]\/n\)\?" conda install opencv
    
    This matches conda's prompt ([y]/n)? and sends a notification when it's asking for user input.
  • Running very long machine learning programs on background servers
    $ nohup lookout python train.py
    
    This will run python train.py in the background even with the terminal closed, and you will get a notification when it's done.

Installation

$ pip install lookout-python

When you run lookout for the first time, you will be asked to log in to your Slack application via browser.

After authentication, you will be displayed a code that you need to copy and paste into your terminal window.

Options

  • Set timeout threshold

    --hangthreshold 120
    

    This will set hangthreshold to 120 seconds and will send a Process may be hanging alert after 120 seconds. This value will be saved for next time.

  • Using regex

    --regex "expression"
    

    This will send an alert when the command output matches given regex. Make sure to escape symbols with backslash. Double quotes are only required on some cases (to escape sh).

  • Change slack channel

    $ lookout --change
    

    Run this in order to update or change your Slack channel.

  • Reset

    $ lookout --reset
    

    This will reset to factory settings.

Limitations

  • Color of output may be stripped. This is because some programs strip color from output when it detects that it is outputting to anything else than an actual terminal, and this program uses pipe to parse data.

Changelog

1.0.0 (2023/02/19)

Initial release.

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

lookout-python-1.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lookout_python-1.0.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file lookout-python-1.0.1.tar.gz.

File metadata

  • Download URL: lookout-python-1.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for lookout-python-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9e3f6250bb6bf50b28c8ab07a62e94fba6a76649ad9e73d8f1c38acb75176ce7
MD5 a8b2785634fcd8ef191c8511839a7f06
BLAKE2b-256 1f39d175a1243ea1f6eee45bf63f5040ba946fa5e984eef2736f84fa436b3eff

See more details on using hashes here.

File details

Details for the file lookout_python-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: lookout_python-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for lookout_python-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5acf6d56e3fa41368d6511958fc6a04e4b28be12a0dcc5287b930e8323c7e642
MD5 4427c68163f478a544458c57a347620f
BLAKE2b-256 b51371c0cf20aa49fdc45c83e3bf773f74eb05ad1e6c30cd58e73fd1fe1ae494

See more details on using hashes here.

Supported by

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