F1bonacc1 / process-compose

Process Compose is a simple and flexible scheduler and orchestrator to manage non-containerized applications.
https://f1bonacc1.github.io/process-compose/
Apache License 2.0
1.28k stars 49 forks source link

[Feature Request] Get Individual Process Info/State on CLI #271

Open albertilagan opened 3 days ago

albertilagan commented 3 days ago

Feature Request

Use Case:

Similar to how doing a curl on /processes or /process/<name> can get you details about the process, e.g IsRunning, status, it would be nice to be able to do the same thing on cli

Proposed Change:

process-compose process state process-compose process info

Who Benefits From The Change(s)?

  1. Integrators
  2. Users doing CI test

Alternative Approaches

Alternatively as mention above you can do this by doing a curl on the existing http server, problem is I want to use --unix-socket and afaik if it's enabled http server is disabled,

F1bonacc1 commented 2 days ago

Hi @albertilagan,

Today we have:

>process-compose process list -owide
PID     NAME         NAMESPACE   STATUS      AGE     HEALTH   RESTARTS   EXITCODE   
80414   pc_log       default     Running     2h13m   -        0          0          
80415   postgresql   default     Launching   2h13m   Ready    0          0

or

process-compose process list -ojson
[
        {
                "name": "pc_log",
                "namespace": "default",
                "status": "Running",
                "system_time": "2h13m",
                "age": 7998211577174,
                "is_ready": "-",
                "restarts": 0,
                "exit_code": 0,
                "pid": 80414,
                "is_elevated": false,
                "password_provided": false,
                "mem": 2883584,
                "cpu": 0,
                "IsRunning": true
        },
        {
                "name": "postgresql",
                "namespace": "default",
                "status": "Launching",
                "system_time": "2h13m",
                "age": 7998211618472,
                "is_ready": "Ready",
                "restarts": 0,
                "exit_code": 0,
                "pid": 80415,
                "is_elevated": false,
                "password_provided": false,
                "mem": -1,
                "cpu": -1,
                "IsRunning": true
        }
]

Are you interested in a get command? Something like:

process-compose process get pc_log -owide
PID     NAME         NAMESPACE   STATUS      AGE     HEALTH   RESTARTS   EXITCODE   
80414   pc_log       default     Running     2h13m   -        0          0          
albertilagan commented 2 days ago

Hi @albertilagan,

Today we have:

>process-compose process list -owide
PID     NAME         NAMESPACE   STATUS      AGE     HEALTH   RESTARTS   EXITCODE   
80414   pc_log       default     Running     2h13m   -        0          0          
80415   postgresql   default     Launching   2h13m   Ready    0          0

or

process-compose process list -ojson
[
        {
                "name": "pc_log",
                "namespace": "default",
                "status": "Running",
                "system_time": "2h13m",
                "age": 7998211577174,
                "is_ready": "-",
                "restarts": 0,
                "exit_code": 0,
                "pid": 80414,
                "is_elevated": false,
                "password_provided": false,
                "mem": 2883584,
                "cpu": 0,
                "IsRunning": true
        },
        {
                "name": "postgresql",
                "namespace": "default",
                "status": "Launching",
                "system_time": "2h13m",
                "age": 7998211618472,
                "is_ready": "Ready",
                "restarts": 0,
                "exit_code": 0,
                "pid": 80415,
                "is_elevated": false,
                "password_provided": false,
                "mem": -1,
                "cpu": -1,
                "IsRunning": true
        }
]

Are you interested in a get command? Something like:

process-compose process get pc_log -owide
PID     NAME         NAMESPACE   STATUS      AGE     HEALTH   RESTARTS   EXITCODE   
80414   pc_log       default     Running     2h13m   -        0          0          

Hi, thanks for you reply, yes as you said would be nice to have a get subcommand for getting specific process state.

F1bonacc1 commented 2 days ago

Makes sense. Will add it to the next release.

shivaraj-bh commented 1 day ago

Alternatively as mention above you can do this by doing a curl on the existing http server, problem is I want to use --unix-socket and afaik if it's enabled http server is disabled,

You can still use curl on a unix socket, like curl --unix-socket <path> http://localhost/process/<process-name>, only that the http://localhost is dummy and can be anything, its only purpose is to tell curl that it is a HTTP request.

Anyways, would be nice to have a CLI command too.