tinytaskmanager 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tinytaskmanager-1.0.0/.gitignore +8 -0
- tinytaskmanager-1.0.0/LICENSE +21 -0
- tinytaskmanager-1.0.0/PKG-INFO +119 -0
- tinytaskmanager-1.0.0/README.md +108 -0
- tinytaskmanager-1.0.0/pyproject.toml +38 -0
- tinytaskmanager-1.0.0/tinytaskmanager.py +1311 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Yuri Escalianti <yuriescl@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tinytaskmanager
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Tiny task manager for Linux, MacOS and Unix-like systems
|
|
5
|
+
Project-URL: Homepage, https://github.com/yuriescl/tinytaskmanager
|
|
6
|
+
Author-email: Yuri Escalianti <yuriescl@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
Tiny task manager for Linux, MacOS and Unix-like systems.
|
|
13
|
+
Written as a single Python script.
|
|
14
|
+
|
|
15
|
+
<img src="https://user-images.githubusercontent.com/26092447/224555851-275c66a2-1679-401a-8ca7-a4057406fc77.gif" width="350">
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Download the script directly (recommended):
|
|
20
|
+
```
|
|
21
|
+
curl https://raw.githubusercontent.com/yuriescl/tinytaskmanager/dev/tinytaskmanager.py -o tinytaskmanager
|
|
22
|
+
chmod +x tinytaskmanager
|
|
23
|
+
./tinytaskmanager
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Alternative installation methods
|
|
27
|
+
|
|
28
|
+
#### Installing through pip
|
|
29
|
+
```
|
|
30
|
+
pip install tinytaskmanager
|
|
31
|
+
tinytaskmanager # or python -m tinytaskmanager
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Requirements:
|
|
35
|
+
- `python` >=3.8
|
|
36
|
+
- `ps` (usually available by default)
|
|
37
|
+
|
|
38
|
+
Features:
|
|
39
|
+
- No root access required
|
|
40
|
+
- Daemon-less
|
|
41
|
+
- Easily start, watch, and stop tasks using very simple and direct CLI commands
|
|
42
|
+
- Written as a single script built using only the Python standard library - easy to audit and run
|
|
43
|
+
|
|
44
|
+
Comparison to other popular server task managers:
|
|
45
|
+
- [systemctl](https://www.freedesktop.org/software/systemd/man/systemctl.html)
|
|
46
|
+
- Pros
|
|
47
|
+
- Sophisticated dependency management via `WantedBy`
|
|
48
|
+
- Works well with system services
|
|
49
|
+
- Usually installed by default in any modern server
|
|
50
|
+
- Many advanced options, useful for fine-grained control of system services
|
|
51
|
+
- Cons
|
|
52
|
+
- Unit files are required every time you need to setup a simple background task
|
|
53
|
+
- Difficult to work with when you're not the root user (`systemctl --user` is not so simple to use)
|
|
54
|
+
- If not installed in the system, can be difficult to install and setup as a non-privileged user
|
|
55
|
+
- Difficult for beginners and non-sysadmins
|
|
56
|
+
- [supervisord](http://supervisord.org/)
|
|
57
|
+
- Pros
|
|
58
|
+
- Very advanced and fine-grained control of tasks, similar to systemctl
|
|
59
|
+
- Cons
|
|
60
|
+
- Not usually installed by default in modern servers
|
|
61
|
+
- Even if installed, usually requires root access
|
|
62
|
+
- Difficult for beginners and non-sysadmins
|
|
63
|
+
- [pm2](https://pm2.keymetrics.io/)
|
|
64
|
+
- Pros
|
|
65
|
+
- Modern codebase (JavaScript)
|
|
66
|
+
- Can be easily installed via `npm install pm2`
|
|
67
|
+
- Has advanced integration with Node.js programs (cluster mode, load balancing, etc)
|
|
68
|
+
- Widely known and used in Node.js ecosystem
|
|
69
|
+
- Cons
|
|
70
|
+
- Not usually installed by default in modern servers
|
|
71
|
+
- Might not work so well with non-Node.js software
|
|
72
|
+
- Requires `node` and `npm` to be installed
|
|
73
|
+
- Might consume more RAM than intended since it's JavaScript
|
|
74
|
+
- Can be a bit difficult to setup and run simple tasks
|
|
75
|
+
- [docker](https://www.docker.com/)
|
|
76
|
+
- Pros
|
|
77
|
+
- Quickly spin up a development/production instance given a properly configured Dockerfile
|
|
78
|
+
- Container/Dockerfile can be easily shared accross a development team so everyone can test in same OS environment
|
|
79
|
+
- Widely available and used across many different platforms
|
|
80
|
+
- All dependencies can be installed in the container
|
|
81
|
+
- Cons
|
|
82
|
+
- Requires root access
|
|
83
|
+
- Usually the processes run as the root user, which can lead to major security vulnerabilities
|
|
84
|
+
- Very hard for beginners and non-sysadmins
|
|
85
|
+
- Difficult to run simple tasks that don't need containers
|
|
86
|
+
|
|
87
|
+
`tinytaskmanager` (previously named `ttm`) was initially an attempt (after painfully having to deal with the existing options like PM2, systemctl, etc) to have a script I could easily copy to a server and manage simple tasks like a `gunicorn` server, or a `celery` worker. After a while, `tinytaskmanager` became a very useful tool in day-to-day deployments, so it made sense to make it public.
|
|
88
|
+
|
|
89
|
+
**Examples**
|
|
90
|
+
|
|
91
|
+
Running a script:
|
|
92
|
+
```
|
|
93
|
+
$ tinytaskmanager run ./backup-database.sh --output /backups/database.sql
|
|
94
|
+
$ tinytaskmanager ls
|
|
95
|
+
ID NAME COMMAND UPTIME PID
|
|
96
|
+
1 - ./backup-database.sh --output /backups/database.sql 2s 742537
|
|
97
|
+
$ tinytaskmanager stop 1
|
|
98
|
+
$ tinytaskmanager rm 1
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Running Django server:
|
|
102
|
+
```
|
|
103
|
+
$ tinytaskmanager run --name mydjangoserver python manage.py runserver
|
|
104
|
+
$ tinytaskmanager rm mydjangoserver
|
|
105
|
+
Cannot remove task while it's running.
|
|
106
|
+
To stop it, run:
|
|
107
|
+
tinytaskmanager stop mydjangoserver
|
|
108
|
+
$ tinytaskmanager logs mydjangoserver
|
|
109
|
+
$ tinytaskmanager rm mydjangoserver
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
### Environment
|
|
115
|
+
```
|
|
116
|
+
poetry env use python3.8
|
|
117
|
+
poetry install
|
|
118
|
+
poetry shell
|
|
119
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Tiny task manager for Linux, MacOS and Unix-like systems.
|
|
2
|
+
Written as a single Python script.
|
|
3
|
+
|
|
4
|
+
<img src="https://user-images.githubusercontent.com/26092447/224555851-275c66a2-1679-401a-8ca7-a4057406fc77.gif" width="350">
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Download the script directly (recommended):
|
|
9
|
+
```
|
|
10
|
+
curl https://raw.githubusercontent.com/yuriescl/tinytaskmanager/dev/tinytaskmanager.py -o tinytaskmanager
|
|
11
|
+
chmod +x tinytaskmanager
|
|
12
|
+
./tinytaskmanager
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Alternative installation methods
|
|
16
|
+
|
|
17
|
+
#### Installing through pip
|
|
18
|
+
```
|
|
19
|
+
pip install tinytaskmanager
|
|
20
|
+
tinytaskmanager # or python -m tinytaskmanager
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requirements:
|
|
24
|
+
- `python` >=3.8
|
|
25
|
+
- `ps` (usually available by default)
|
|
26
|
+
|
|
27
|
+
Features:
|
|
28
|
+
- No root access required
|
|
29
|
+
- Daemon-less
|
|
30
|
+
- Easily start, watch, and stop tasks using very simple and direct CLI commands
|
|
31
|
+
- Written as a single script built using only the Python standard library - easy to audit and run
|
|
32
|
+
|
|
33
|
+
Comparison to other popular server task managers:
|
|
34
|
+
- [systemctl](https://www.freedesktop.org/software/systemd/man/systemctl.html)
|
|
35
|
+
- Pros
|
|
36
|
+
- Sophisticated dependency management via `WantedBy`
|
|
37
|
+
- Works well with system services
|
|
38
|
+
- Usually installed by default in any modern server
|
|
39
|
+
- Many advanced options, useful for fine-grained control of system services
|
|
40
|
+
- Cons
|
|
41
|
+
- Unit files are required every time you need to setup a simple background task
|
|
42
|
+
- Difficult to work with when you're not the root user (`systemctl --user` is not so simple to use)
|
|
43
|
+
- If not installed in the system, can be difficult to install and setup as a non-privileged user
|
|
44
|
+
- Difficult for beginners and non-sysadmins
|
|
45
|
+
- [supervisord](http://supervisord.org/)
|
|
46
|
+
- Pros
|
|
47
|
+
- Very advanced and fine-grained control of tasks, similar to systemctl
|
|
48
|
+
- Cons
|
|
49
|
+
- Not usually installed by default in modern servers
|
|
50
|
+
- Even if installed, usually requires root access
|
|
51
|
+
- Difficult for beginners and non-sysadmins
|
|
52
|
+
- [pm2](https://pm2.keymetrics.io/)
|
|
53
|
+
- Pros
|
|
54
|
+
- Modern codebase (JavaScript)
|
|
55
|
+
- Can be easily installed via `npm install pm2`
|
|
56
|
+
- Has advanced integration with Node.js programs (cluster mode, load balancing, etc)
|
|
57
|
+
- Widely known and used in Node.js ecosystem
|
|
58
|
+
- Cons
|
|
59
|
+
- Not usually installed by default in modern servers
|
|
60
|
+
- Might not work so well with non-Node.js software
|
|
61
|
+
- Requires `node` and `npm` to be installed
|
|
62
|
+
- Might consume more RAM than intended since it's JavaScript
|
|
63
|
+
- Can be a bit difficult to setup and run simple tasks
|
|
64
|
+
- [docker](https://www.docker.com/)
|
|
65
|
+
- Pros
|
|
66
|
+
- Quickly spin up a development/production instance given a properly configured Dockerfile
|
|
67
|
+
- Container/Dockerfile can be easily shared accross a development team so everyone can test in same OS environment
|
|
68
|
+
- Widely available and used across many different platforms
|
|
69
|
+
- All dependencies can be installed in the container
|
|
70
|
+
- Cons
|
|
71
|
+
- Requires root access
|
|
72
|
+
- Usually the processes run as the root user, which can lead to major security vulnerabilities
|
|
73
|
+
- Very hard for beginners and non-sysadmins
|
|
74
|
+
- Difficult to run simple tasks that don't need containers
|
|
75
|
+
|
|
76
|
+
`tinytaskmanager` (previously named `ttm`) was initially an attempt (after painfully having to deal with the existing options like PM2, systemctl, etc) to have a script I could easily copy to a server and manage simple tasks like a `gunicorn` server, or a `celery` worker. After a while, `tinytaskmanager` became a very useful tool in day-to-day deployments, so it made sense to make it public.
|
|
77
|
+
|
|
78
|
+
**Examples**
|
|
79
|
+
|
|
80
|
+
Running a script:
|
|
81
|
+
```
|
|
82
|
+
$ tinytaskmanager run ./backup-database.sh --output /backups/database.sql
|
|
83
|
+
$ tinytaskmanager ls
|
|
84
|
+
ID NAME COMMAND UPTIME PID
|
|
85
|
+
1 - ./backup-database.sh --output /backups/database.sql 2s 742537
|
|
86
|
+
$ tinytaskmanager stop 1
|
|
87
|
+
$ tinytaskmanager rm 1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Running Django server:
|
|
91
|
+
```
|
|
92
|
+
$ tinytaskmanager run --name mydjangoserver python manage.py runserver
|
|
93
|
+
$ tinytaskmanager rm mydjangoserver
|
|
94
|
+
Cannot remove task while it's running.
|
|
95
|
+
To stop it, run:
|
|
96
|
+
tinytaskmanager stop mydjangoserver
|
|
97
|
+
$ tinytaskmanager logs mydjangoserver
|
|
98
|
+
$ tinytaskmanager rm mydjangoserver
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
### Environment
|
|
104
|
+
```
|
|
105
|
+
poetry env use python3.8
|
|
106
|
+
poetry install
|
|
107
|
+
poetry shell
|
|
108
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tinytaskmanager"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Tiny task manager for Linux, MacOS and Unix-like systems"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.8"
|
|
7
|
+
license = { text = "MIT License" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Yuri Escalianti", email = "yuriescl@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[project.urls]
|
|
13
|
+
Homepage = "https://github.com/yuriescl/tinytaskmanager"
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
tinytaskmanager = "tinytaskmanager:main"
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"black>=22.3.0",
|
|
21
|
+
"flake8>=4.0.1",
|
|
22
|
+
"mypy>=0.971",
|
|
23
|
+
"pynvim>=0.4.3",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[build-system]
|
|
27
|
+
requires = ["hatchling"]
|
|
28
|
+
build-backend = "hatchling.build"
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.wheel]
|
|
31
|
+
include = ["tinytaskmanager.py"]
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.sdist]
|
|
34
|
+
include = [
|
|
35
|
+
"tinytaskmanager.py",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE",
|
|
38
|
+
]
|