am3


Nameam3 JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/nriver/am3
SummaryApplication Manager written with python 3
upload_time2024-12-26 05:46:54
maintainerNone
docs_urlNone
authorNriver
requires_python<4,>=3.6
licenseNone
keywords application manger process manager
VCS
bugtrack_url
requirements loguru flask psutil PrettyTable python-socketio websockets watchdog click
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # am3

AM3 = Application Manager written with python 3


## ๐Ÿฆฎ Table of Contents

<!--ts-->
* [am3](#am3)
   * [๐Ÿฆฎ Table of Contents](#-table-of-contents)
   * [๐Ÿ”ง Installation](#-installation)
   * [๐Ÿ“– (Basic) Usage](#-basic-usage)
      * [List Applications](#list-applications)
      * [Start an Application](#start-an-application)
         * [Specify the main script or file](#specify-the-main-script-or-file)
         * [Specify a custom interpreter](#specify-a-custom-interpreter)
         * [Start executable files directly](#start-executable-files-directly)
      * [Stop an Application](#stop-an-application)
   * [โš™๏ธ Advanced Parameters](#๏ธ-advanced-parameters)
      * [Generate Configuration](#generate-configuration)
      * [Load Configuration](#load-configuration)
      * [Restart Keywords](#restart-keywords)
      * [Set Working Directory](#set-working-directory)
      * [Set Restart Delay](#set-restart-delay)
      * [Use Regular Expressions for Restart Keywords](#use-regular-expressions-for-restart-keywords)
      * [Restart Check Delay](#restart-check-delay)
      * [Pre-Execution Environment Check](#pre-execution-environment-check)
      * [Assign Application Name](#assign-application-name)
* [๐Ÿ™ Thanks](#-thanks)
<!--te-->


## ๐Ÿ”ง Installation

Python3 is required, which should be available on most of the modern Linux distributions.

Install am3 with this command:

```bash
pip install am3
```

Then you can use it with `am` or `am3`.

---

## ๐Ÿ“– (Basic) Usage

### List Applications

Retrieve and display information about running applications, including their name, ID, and other details.

```bash
am3 ls
```

---

### Start an Application

Launch an application by specifying a command and parameters:

```bash
am --start "ping" --params "127.0.0.1 -c 5"
```

By default, **am3** will automatically restart the application if it exits unexpectedly. Each application is assigned a
unique ID, which can be used to manage or interact with the application.

#### Specify the main script or file

Use the `-s` option to specify the main script or file. If the script is a Python file, the Python interpreter is
automatically invoked. Similarly, shell scripts are executed using Bash. This behavior is defined in the
`guess_interpreter` function.

```bash
am -s example/counter.py
```

#### Specify a custom interpreter

If needed, you can explicitly define the interpreter using the `-i` option:

```bash
am -s example/counter.py -i python3
```

#### Start executable files directly

If youโ€™re running the executable in the current directory, use:

```bash
./am -s example/counter.py -i python3
```

Alternatively, you can use symbolic links for starting executables:

```bash
am -s example/counter.py
```

---

### Stop an Application

Terminate a running application by using its ID:

```bash
am stop 0
```

---

## โš™๏ธ Advanced Parameters

### Generate Configuration

You can save the configuration for reuse with the `-g` option:

```bash
am -s example/counter.py -i python3 -g example/counter_config.json
```

### Load Configuration

To reuse a previously saved configuration file, use:

```bash
am -c example/counter_config.json
```

### Restart Keywords

Define specific keywords that trigger automatic restarts if they appear in the application output:

```bash
am -s example/counter.py -i python3 --restart_keyword "Exception XXX" "Exception YYY" -g example/counter_config.json
```

### Set Working Directory

Specify the working directory for the application:

```bash
am -s counter.py -i python3 --restart_keyword "Exception XXX" "Exception YYY" -d "/home/nate/gitRepo/am3/example/" -g example/counter_config.json
```

### Set Restart Delay

Define a delay (in seconds) before restarting the application:

```bash
am -s counter.py -i python3 --restart_keyword "Exception XXX" "Exception YYY" -d "/home/nate/gitRepo/am3/example/" -t 3 -g example/counter_config.json
```

### Use Regular Expressions for Restart Keywords

Specify regular expressions as restart keywords for more flexible matching:

```bash
am -s counter.py -i python3  --restart_keyword "Exception XXX" --restart_keyword "Exception YYY" \
  --restart_keyword_regex "| 0.00 |" --restart_keyword_regex "2\\d\\.\\d\\d KB/s" \
  -d "/home/nate/gitRepo/am3/example/" -t 3 -g example/counter_config.json
```

### Restart Check Delay

Set a delay for how often to check if the application should restart:

```bash
am -s counter.py -i python3 --restart_check_delay 0 --restart_keyword "Exception XXX" \
  --restart_keyword "Exception YYY" --restart_keyword_regex "| 0.00 |" \
  --restart_keyword_regex "2\\d\\.\\d\\d KB/s" \
  -d "/home/nate/gitRepo/am3/example/" -t 3 -g example/counter_config.json
```

### Pre-Execution Environment Check

Run a pre-check script to validate the environment before executing the main application. The script's `check` function
is automatically called every second until it returns `True`.

```bash
am -s counter.py -i python3 --restart_check_delay 0 --restart_keyword "Exception XXX" \
  --restart_keyword "Exception YYY" --restart_keyword_regex "| 0.00 |" \
  --restart_keyword_regex "2\\d\\.\\d\\d KB/s" -d "/home/nate/gitRepo/am3/example/" \
  -t 3 -b "example/counter_before_execute.py" -g example/counter_config.json
```

### Assign Application Name

You can specify a custom name for the application:

```bash
am -s counter.py -i python3 --restart_check_delay 0 --restart_keyword "Exception XXX" \
  --restart_keyword "Exception YYY" --restart_keyword_regex "| 0.00 |" \
  --restart_keyword_regex "2\\d\\.\\d\\d KB/s" -d "/home/nate/gitRepo/am3/example/" \
  -t 3 -b "example/counter_before_execute.py" --name counter -g example/counter_config.json
```

--- 

# ๐Ÿ™ Thanks

Thanks for the great IDE Pycharm from Jetbrains.

[![Jetbrains](docs/jetbrains.svg)](https://jb.gg/OpenSource)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nriver/am3",
    "name": "am3",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.6",
    "maintainer_email": null,
    "keywords": "application manger, process manager",
    "author": "Nriver",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# am3\n\nAM3 = Application Manager written with python 3\n\n\n## \ud83e\uddae Table of Contents\n\n<!--ts-->\n* [am3](#am3)\n   * [\ud83e\uddae Table of Contents](#-table-of-contents)\n   * [\ud83d\udd27 Installation](#-installation)\n   * [\ud83d\udcd6 (Basic) Usage](#-basic-usage)\n      * [List Applications](#list-applications)\n      * [Start an Application](#start-an-application)\n         * [Specify the main script or file](#specify-the-main-script-or-file)\n         * [Specify a custom interpreter](#specify-a-custom-interpreter)\n         * [Start executable files directly](#start-executable-files-directly)\n      * [Stop an Application](#stop-an-application)\n   * [\u2699\ufe0f Advanced Parameters](#\ufe0f-advanced-parameters)\n      * [Generate Configuration](#generate-configuration)\n      * [Load Configuration](#load-configuration)\n      * [Restart Keywords](#restart-keywords)\n      * [Set Working Directory](#set-working-directory)\n      * [Set Restart Delay](#set-restart-delay)\n      * [Use Regular Expressions for Restart Keywords](#use-regular-expressions-for-restart-keywords)\n      * [Restart Check Delay](#restart-check-delay)\n      * [Pre-Execution Environment Check](#pre-execution-environment-check)\n      * [Assign Application Name](#assign-application-name)\n* [\ud83d\ude4f Thanks](#-thanks)\n<!--te-->\n\n\n## \ud83d\udd27 Installation\n\nPython3 is required, which should be available on most of the modern Linux distributions.\n\nInstall am3 with this command:\n\n```bash\npip install am3\n```\n\nThen you can use it with `am` or `am3`.\n\n---\n\n## \ud83d\udcd6 (Basic) Usage\n\n### List Applications\n\nRetrieve and display information about running applications, including their name, ID, and other details.\n\n```bash\nam3 ls\n```\n\n---\n\n### Start an Application\n\nLaunch an application by specifying a command and parameters:\n\n```bash\nam --start \"ping\" --params \"127.0.0.1 -c 5\"\n```\n\nBy default, **am3** will automatically restart the application if it exits unexpectedly. Each application is assigned a\nunique ID, which can be used to manage or interact with the application.\n\n#### Specify the main script or file\n\nUse the `-s` option to specify the main script or file. If the script is a Python file, the Python interpreter is\nautomatically invoked. Similarly, shell scripts are executed using Bash. This behavior is defined in the\n`guess_interpreter` function.\n\n```bash\nam -s example/counter.py\n```\n\n#### Specify a custom interpreter\n\nIf needed, you can explicitly define the interpreter using the `-i` option:\n\n```bash\nam -s example/counter.py -i python3\n```\n\n#### Start executable files directly\n\nIf you\u2019re running the executable in the current directory, use:\n\n```bash\n./am -s example/counter.py -i python3\n```\n\nAlternatively, you can use symbolic links for starting executables:\n\n```bash\nam -s example/counter.py\n```\n\n---\n\n### Stop an Application\n\nTerminate a running application by using its ID:\n\n```bash\nam stop 0\n```\n\n---\n\n## \u2699\ufe0f Advanced Parameters\n\n### Generate Configuration\n\nYou can save the configuration for reuse with the `-g` option:\n\n```bash\nam -s example/counter.py -i python3 -g example/counter_config.json\n```\n\n### Load Configuration\n\nTo reuse a previously saved configuration file, use:\n\n```bash\nam -c example/counter_config.json\n```\n\n### Restart Keywords\n\nDefine specific keywords that trigger automatic restarts if they appear in the application output:\n\n```bash\nam -s example/counter.py -i python3 --restart_keyword \"Exception XXX\" \"Exception YYY\" -g example/counter_config.json\n```\n\n### Set Working Directory\n\nSpecify the working directory for the application:\n\n```bash\nam -s counter.py -i python3 --restart_keyword \"Exception XXX\" \"Exception YYY\" -d \"/home/nate/gitRepo/am3/example/\" -g example/counter_config.json\n```\n\n### Set Restart Delay\n\nDefine a delay (in seconds) before restarting the application:\n\n```bash\nam -s counter.py -i python3 --restart_keyword \"Exception XXX\" \"Exception YYY\" -d \"/home/nate/gitRepo/am3/example/\" -t 3 -g example/counter_config.json\n```\n\n### Use Regular Expressions for Restart Keywords\n\nSpecify regular expressions as restart keywords for more flexible matching:\n\n```bash\nam -s counter.py -i python3  --restart_keyword \"Exception XXX\" --restart_keyword \"Exception YYY\" \\\n  --restart_keyword_regex \"| 0.00 |\" --restart_keyword_regex \"2\\\\d\\\\.\\\\d\\\\d KB/s\" \\\n  -d \"/home/nate/gitRepo/am3/example/\" -t 3 -g example/counter_config.json\n```\n\n### Restart Check Delay\n\nSet a delay for how often to check if the application should restart:\n\n```bash\nam -s counter.py -i python3 --restart_check_delay 0 --restart_keyword \"Exception XXX\" \\\n  --restart_keyword \"Exception YYY\" --restart_keyword_regex \"| 0.00 |\" \\\n  --restart_keyword_regex \"2\\\\d\\\\.\\\\d\\\\d KB/s\" \\\n  -d \"/home/nate/gitRepo/am3/example/\" -t 3 -g example/counter_config.json\n```\n\n### Pre-Execution Environment Check\n\nRun a pre-check script to validate the environment before executing the main application. The script's `check` function\nis automatically called every second until it returns `True`.\n\n```bash\nam -s counter.py -i python3 --restart_check_delay 0 --restart_keyword \"Exception XXX\" \\\n  --restart_keyword \"Exception YYY\" --restart_keyword_regex \"| 0.00 |\" \\\n  --restart_keyword_regex \"2\\\\d\\\\.\\\\d\\\\d KB/s\" -d \"/home/nate/gitRepo/am3/example/\" \\\n  -t 3 -b \"example/counter_before_execute.py\" -g example/counter_config.json\n```\n\n### Assign Application Name\n\nYou can specify a custom name for the application:\n\n```bash\nam -s counter.py -i python3 --restart_check_delay 0 --restart_keyword \"Exception XXX\" \\\n  --restart_keyword \"Exception YYY\" --restart_keyword_regex \"| 0.00 |\" \\\n  --restart_keyword_regex \"2\\\\d\\\\.\\\\d\\\\d KB/s\" -d \"/home/nate/gitRepo/am3/example/\" \\\n  -t 3 -b \"example/counter_before_execute.py\" --name counter -g example/counter_config.json\n```\n\n--- \n\n# \ud83d\ude4f Thanks\n\nThanks for the great IDE Pycharm from Jetbrains.\n\n[![Jetbrains](docs/jetbrains.svg)](https://jb.gg/OpenSource)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Application Manager written with python 3",
    "version": "1.0.3",
    "project_urls": {
        "Bug Reports": "https://github.com/nriver/am3/issues",
        "Funding": "https://github.com/nriver/am3",
        "Homepage": "https://github.com/nriver/am3",
        "Say Thanks!": "https://github.com/nriver/am3",
        "Source": "https://github.com/nriver/am3/"
    },
    "split_keywords": [
        "application manger",
        " process manager"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "113d32459ded8adcf5c1d6a9bd63a8515ef97d6caa54932f0bd94e9e347464b5",
                "md5": "ef10cc895f4e356f8bb0f34da3cae402",
                "sha256": "eb34360d0f6771f5eb375887eac38a8b45eced1e46a0feb01fcf7a1364c4c516"
            },
            "downloads": -1,
            "filename": "am3-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef10cc895f4e356f8bb0f34da3cae402",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.6",
            "size": 30554,
            "upload_time": "2024-12-26T05:46:54",
            "upload_time_iso_8601": "2024-12-26T05:46:54.023891Z",
            "url": "https://files.pythonhosted.org/packages/11/3d/32459ded8adcf5c1d6a9bd63a8515ef97d6caa54932f0bd94e9e347464b5/am3-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-26 05:46:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nriver",
    "github_project": "am3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "loguru",
            "specs": []
        },
        {
            "name": "flask",
            "specs": []
        },
        {
            "name": "psutil",
            "specs": []
        },
        {
            "name": "PrettyTable",
            "specs": []
        },
        {
            "name": "python-socketio",
            "specs": [
                [
                    "==",
                    "5.11.2"
                ]
            ]
        },
        {
            "name": "websockets",
            "specs": [
                [
                    "==",
                    "12.0"
                ]
            ]
        },
        {
            "name": "watchdog",
            "specs": []
        },
        {
            "name": "click",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "am3"
}
        
Elapsed time: 2.39991s