maxhumber / hickory Goto Github PK
View Code? Open in Web Editor NEWCommand line tool for scheduling Python scripts
License: MIT License
Command line tool for scheduling Python scripts
License: MIT License
Right now terminal notifications are supremely lacking. We should use red and green colours!
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.
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
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;
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.
hickory kill foo.oy
Killed foo.oy
Definitely wrong...
Add type hint support
Successfully install hickory with pip3 tool.
But it shows hickory command not find when I type hickory.
Centos 7
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:
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
Change behaviour to either:
A) Not create hickory.log
B) Actually log the trigger times of the script
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.