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.0b1.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.0b1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langtools_cli-0.1.0b1.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.0b1.tar.gz
Algorithm Hash digest
SHA256 601b5afe1bb1458a97e434dafe091d2344a64efbc21632bba05f82afb8d82d6e
MD5 0be812074aa8388ab1dca63c8e0bc50f
BLAKE2b-256 0b8faeb027baac10cc7abb955f8b378f94f737d1abc46695a96db1396f6a3786

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langtools_cli-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 49a61957a463515c3f17ae31e77d84d481d445001425d0e9f0a6f8381d452e4e
MD5 3714375f966c197fa51ebe211f16a7a2
BLAKE2b-256 694870951e56c7c9ed4c71d4a6bcaa2dd883b8f389b081302120da5f87c3cde5

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