GithubHelp home page GithubHelp logo

maxhumber / hickory Goto Github PK

View Code? Open in Web Editor NEW
147.0 147.0 11.0 779 KB

Command line tool for scheduling Python scripts

License: MIT License

Python 100.00%
hacktoberfest schedule scheduling-python-scripts

hickory's People

Contributors

maxhumber avatar vipul-bajaj avatar vjern avatar zebralt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hickory's Issues

Cannot show status and it does not schedule either

Describe the bug
I followed the readme, but did not succeed.
To Reproduce
Create a foo.py

import datetime
import time

stamp = datetime.datetime.now().strftime("%H:%M:%S")
time.sleep(5)

print(f"Foo - {stamp} + 5 seconds")

Then schedule with hickory schedule foo.py --every=10s

Then check the status using hickory status

Expected behavior
Expect the schedule will work and the show the status of all scheduled jobs

Environment:

  • OS: [Linux] (Windows subsystem linux 2)
  • Version: [Ubuntu 20.04.1 LTS]

Additional context
When I check status, it shows

Traceback (most recent call last):
  File "/home/jake/anaconda3/bin/hickory", line 8, in <module>
    sys.exit(main())
  File "/home/jake/anaconda3/lib/python3.8/site-packages/hickory/cli.py", line 86, in main
    return status()
  File "/home/jake/anaconda3/lib/python3.8/site-packages/hickory/cli.py", line 71, in status
    return status_systemd()
  File "/home/jake/anaconda3/lib/python3.8/site-packages/hickory/systemd.py", line 126, in status_systemd
    info_dicts = [_service_info(s) for s in services]
  File "/home/jake/anaconda3/lib/python3.8/site-packages/hickory/systemd.py", line 126, in <listcomp>
    info_dicts = [_service_info(s) for s in services]
  File "/home/jake/anaconda3/lib/python3.8/site-packages/hickory/systemd.py", line 118, in _service_info
    state = _find_state(short)
  File "/home/jake/anaconda3/lib/python3.8/site-packages/hickory/systemd.py", line 105, in _find_state
    state = re.findall("Active: (.*?)\n", status)[0]
IndexError: list index out of range

Feature Request: allow for command line input

At the moment the command line only allows you to pass a python file. The merit to this is that things remain simple. But one might wonder, could we also run anything that the command line could run?

That way hickory could also be used to run;

  • scripts from non-python languages
  • jupyter notebooks
  • docker containers

The API might still allow it via something like;

hickory schedule "docker run ..." --every=1hour
hickory schedule "jupyter nbconvert notebook.ipynb" --every=1hour

If this is out of scope of the library I understand. There's merit to keeping a tool small.

Cannot run Hickory on specific ubuntu variants.

I am trying to run hickory on PopOS (which I think is a variant of ubuntu) and it seems to complain about the folder structure.

hickory schedule scripts/grab_issues.py --every 2hours
Traceback (most recent call last):
  File "/home/vincent/Development/gh-dashb/venv/bin/hickory", line 8, in <module>
    sys.exit(main())
  File "/home/vincent/Development/gh-dashb/venv/lib/python3.7/site-packages/hickory/cli.py", line 83, in main
    schedule(args.script, args.every)
  File "/home/vincent/Development/gh-dashb/venv/lib/python3.7/site-packages/hickory/cli.py", line 35, in schedule
    schedule_systemd(label, working_directory, which_python, script, every)
  File "/home/vincent/Development/gh-dashb/venv/lib/python3.7/site-packages/hickory/systemd.py", line 74, in schedule_systemd
    dump_string(service, f"{SYSTEMD_PATH}/{label}.service")
  File "/home/vincent/Development/gh-dashb/venv/lib/python3.7/site-packages/hickory/systemd.py", line 66, in dump_string
    with open(path, "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/vincent/.config/systemd/user/hickory.3825d9.scripts/grab_issues.py.service'

I can confirm that the /home/vincent/.config/systemd/user path exists, so maybe this is a file that didn't get created?

Environment:

> pip freeze | grep hickory
hickory==1.0.0

> cat /etc/os-release
NAME="Pop!_OS"
VERSION="20.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
LOGO=distributor-logo-pop-os

Feature Request: --retry

I like the philosophy behind hickory but I'm wondering if it makes sense to add a retry mechanic.

One of the main reasons some of my old clients resorted to airflow was because of the retry mechanics in them. It feels like API-wise we could add two extra flags. One for how often we should attempt a retry and another one for how long to wait between retries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.