process-compose icon indicating copy to clipboard operation
process-compose copied to clipboard

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

Open albertilagan opened this issue 1 year ago • 3 comments

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,

albertilagan avatar Oct 25 '24 11:10 albertilagan

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          

F1bonacc1 avatar Oct 26 '24 13:10 F1bonacc1

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.

albertilagan avatar Oct 26 '24 13:10 albertilagan

Makes sense. Will add it to the next release.

F1bonacc1 avatar Oct 26 '24 13:10 F1bonacc1

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.

shivaraj-bh avatar Oct 27 '24 19:10 shivaraj-bh

Added in v1.40.0

F1bonacc1 avatar Nov 09 '24 17:11 F1bonacc1