add more notes
This commit is contained in:
69
DESIGN.md
69
DESIGN.md
@@ -142,9 +142,26 @@ and closes all its file descriptor.
|
||||
| fifo | `${HOME}/.config/chore/cache/${session}/jobs/${job_name}-${date}.stdin` | job stdin fifo (disabled by default)
|
||||
| file | `${HOME}/.config/chore/cache/${session}/jobs/${job_name}-${date}.stdout` | job stdout log file
|
||||
| file | `${HOME}/.config/chore/cache/${session}/jobs/${job_name}-${date}.stderr` | job stderr log file
|
||||
| file | `${HOME}/.config/chore/cache/${session}/jobs/${job_name}-${date}.stats` | stats file (dynamically overwritten)
|
||||
|
||||
## Memory view
|
||||
|
||||
## Features
|
||||
|
||||
### Debug mode
|
||||
|
||||
When in debug mode, `chored` and `chored` workers print verbose
|
||||
information during the different tasks they have to apply.
|
||||
|
||||
### React mode
|
||||
|
||||
### Pin mode
|
||||
|
||||
A job can be pinned, that's mean its current state (even if stopped)
|
||||
will never be removed. This job can be restarted on demand, its state
|
||||
and stats will be updated accordingly. When unpinned, the job state
|
||||
will be cleaned if someone check its jobs.
|
||||
|
||||
## Operating Systems Specificities
|
||||
|
||||
### OpenBSD
|
||||
@@ -175,6 +192,58 @@ Mainly OpenBSD [`cron(8)`](https://man.openbsd.org/cron) daemon and by
|
||||
extension [`at(1)`](https://man.openbsd.org/at.1) but also
|
||||
[Hashicorp Nomad](https://www.nomadproject.io/).
|
||||
|
||||
### Why libevent?
|
||||
|
||||
To deal with many file descriptors, one can use
|
||||
[`select(2)`](https://man.openbsd.org/select) or
|
||||
[`poll(2)`](https://man.openbsd.org/poll), but the way to deal with
|
||||
that can be quite complex, and `libevent` was designed for this kind
|
||||
of issue
|
||||
|
||||
### Why process first?
|
||||
|
||||
Threads are complex to manage, can lead to many problems no one wants
|
||||
to deal with. Processes are not easy to manage at first, but they are
|
||||
isolated between them. Furthermore, the current application does not
|
||||
need incredible performance, the goal is to follow and processes
|
||||
locally.
|
||||
|
||||
### Why stack first?
|
||||
|
||||
Well, for the first part of the project, the main goal is to create a
|
||||
job scheduler (that's what it is, spawning a command, waiting for its
|
||||
result and so on). No thread, only new processes with
|
||||
[`fork(2)`](https://man.openbsd.org/fork) and
|
||||
[`execve(2)`](https://man.openbsd.org/execve). A big part of the
|
||||
required information can be put on the stack, it looks even more
|
||||
possible if hard limits are set during compile time.
|
||||
|
||||
Don't forget, this project MUST BE minimalist.
|
||||
|
||||
|
||||
## Ideas
|
||||
|
||||
- configuration file
|
||||
- chored state file (configuration?)
|
||||
- pre-command
|
||||
- post-command
|
||||
- react on started job(s)
|
||||
- react on stopped job(s)
|
||||
- react on killed job(s)
|
||||
- logs rotation
|
||||
- alert(s)
|
||||
- capabilities
|
||||
- (linux) namespace
|
||||
- (linux) cgroup
|
||||
- (freebsd) jails
|
||||
- communication between workers
|
||||
- using [zeromq](https://zeromq.org/)?
|
||||
- using binary format or a serializer between chored and its workers
|
||||
- cbor? see [tinycbor](https://github.com/intel/tinycbor)
|
||||
- etf? see [erlang term format](https://www.erlang.org/doc/apps/erts/erl_ext_dist)
|
||||
|
||||
### Configuration file
|
||||
|
||||
## References and Resources
|
||||
|
||||
[libevent](https://libevent.org/)
|
||||
|
||||
@@ -61,6 +61,7 @@ chore -- ${command}
|
||||
| - | wip | `-d` | | switch to debug mode
|
||||
| - | wip | `-j` | `str[j]` | set job name also called job id
|
||||
| - | wip | `-n` | `str[n]` | set `chored` session name
|
||||
| - | wip | `-s` | | secure mode, set only required information (e.g. environment)
|
||||
| - | wip | `-e` | `str[e]` | reset environment variables and set variables
|
||||
| - | wip | `-l` | | list current jobs
|
||||
| - | wip | `-s` | | list job state (require `-j`)
|
||||
@@ -74,6 +75,8 @@ chore -- ${command}
|
||||
| - | wip | `-r` | `str[r]` | set a pattern to react. read line by line or truncate long buffer to 255 chars.
|
||||
| - | wip | `-R` | `str[R]` | set an action when a pattern is found (require `-r`)
|
||||
| - | wip | `-x` | | restart automatically the job in case of failure
|
||||
| - | wip | `-p` | | Pin job, it will not be removed from the job list when done, it could then be restarted
|
||||
| - | wip | `-P` | | Unpin job
|
||||
| - | wip | `--` | `str[-]` | all characters after `--` until carriage retun are considered part of the command
|
||||
|
||||
- `str[j]`: `^[0-9a-zA-Z_]{1,63}$`
|
||||
|
||||
Reference in New Issue
Block a user