Skip to main content

A CLI tool for packaging and submitting Python files to feeds and Ray clusters.

Project description

LangTools CLI

LangTools supports CLI to help submit jobs to Ray or other hosting platforms (To be supported).

Installation

Note: This tool can only be used in Linux or WSL environments.

You have two options to install LangTools:

Option 1: Use the Installation Script

We provide a script to install LangTools and its prerequisites in one command. Run the following command in your terminal, go to langtools\packages\cli:

bash install_langtools.sh

After running the script, activate conda venv:

conda activate langtools-venv

Option 2: Follow the Steps Manually

  1. Install Python version 3.8 to 3.11: These versions are required because Ray 2.10.0, a dependency of LangTools, supports only these Python versions. You can use Conda to create a Python environment if you do not want to change your local Python version.

  2. Install .NET runtime: The .NET runtime is required for the keyring package, which is used for secure storage and retrieval of credentials.

    wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    rm packages-microsoft-prod.deb
    sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-9.0
    
  3. Install keyring and artifacts-keyring: These Python packages are used for secure storage and retrieval of credentials, as well as for accessing private package feeds.

    pip install keyring artifacts-keyring
    
  4. Install xdg utilities: These utilities are required for handling desktop integration tasks, such as opening URLs or files in the default application.

    sudo apt install xdg-utils
    
  5. Install wslu (https://wslutiliti.es/wslu/install.html): This package provides a set of utilities to enhance the WSL (Windows Subsystem for Linux) experience, enabling better integration between Windows and Linux environments.

    sudo add-apt-repository ppa:wslutilities/wslu
    sudo apt update
    sudo apt install wslu
    
  6. Install LangTools_CLI:

    pip install langtools_cli --extra-index-url=https://pkgs.dev.azure.com/msasg/WebXT/_packaging/Repo/pypi/simple/
    

Usage

LangTools provides two main commands:

1. PackAndUpload

This command packages a Python file and uploads it to a specified feed.

langtools PackAndUpload -file <file_path> -version <package_version> -feed <feed_url>
  • -file: The Python file to package.
  • -version: The version of the package.
  • -feed: The feed URL to upload the package to.

2. Deploy

This command deploys a Python file to a Ray cluster.

langtools deploy -f <file_path> -c <ray_cluster_url> [-r <requirements_path>] [--feed <feed_url>] [--num-cpus <number_of_cpus>] [-t <type>] [-h <host_target>]
  • -f, --file: The Python file to deploy. This should be the entry point file of your tool.
  • -c, --cluster: The URL of the Ray cluster where the job will be deployed.
  • -r, --requirements: (Optional) Path to a requirements.txt file for additional dependencies.
  • --feed: (Optional) Feed URL for additional dependencies. If not provided, a default feed URL will be used.
  • --num-cpus: (Optional) Number of CPUs to allocate for the entrypoint. Defaults to 1.
  • -t, --type: (Optional) Type of application to deploy. Defaults to job. Currently, only job type is supported.
  • --target-host: (Optional) Target platform for deployment. Defaults to ray. Currently, only the ray platform is supported.

Example

langtools PackAndUpload -file example.py -version 1.0.0 -feed https://example-feed-url.com
langtools Submit -file example.py -cluster http://example-ray-cluster.com -requirements requirements.txt -feed https://example-feed-url.com -num_cpus 4

Authentication Notes

  • The Ray worker in "default-prod" cluster is running with a PME managed identity:
    • client_id: 506ba7c7-124d-41cf-bb1f-829fa84990ad
    • object_id: c67f2f36-4de9-4f0b-997a-fa9cb9e8ddf4
  • The managed identity (MI) already has access to Papyrus.
  • Use the AAD scope api://56eb33f7-8aa4-47f6-b898-bd7ebb109bed/.default for Papyrus authentication.

Additional Notes

In your application, you can use different environment files to configure settings for local or Ray environments, such as .local.env and .ray.env. Similarly, you can use separate requirements.txt files for Ray, like requirements_ray.txt.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langtools_cli-0.1.0b2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langtools_cli-0.1.0b2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file langtools_cli-0.1.0b2.tar.gz.

File metadata

  • Download URL: langtools_cli-0.1.0b2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for langtools_cli-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 0aa6ed685c1eee7f7279c967c3211b8ef7fc6f04ce2e371db0c6a832d94f974e
MD5 e89d2cd4bd9c73e054f7ebb801fbf902
BLAKE2b-256 754211cb734daa3b4514d6c13621e0b0b2bc44f0c902e31bd479641307453a87

See more details on using hashes here.

File details

Details for the file langtools_cli-0.1.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for langtools_cli-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 3fcb02f84db2bb9f39ed3e87dbd5078808a4d592b92fc90e785b4f0029d45b92
MD5 c919168c09adaaeb36eaf666666cdd5a
BLAKE2b-256 1efb281890ef4128d6a278c21357a1cf28841f6197f4308ce76dfe2c2e837e06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page