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.0b3.tar.gz (12.5 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.0b3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langtools_cli-0.1.0b3.tar.gz
  • Upload date:
  • Size: 12.5 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.0b3.tar.gz
Algorithm Hash digest
SHA256 e1b08573538e8507d53481b90158836a122c58cd37c99830e4481a3ba874932a
MD5 332c4b9773ae966927f1e3a363419d55
BLAKE2b-256 a43c434e2bb1e48e8e853039e0dbe6146157a13b1017a3b7eddd530343e66fb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langtools_cli-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 de35a2885445c5eb75c1432f9904a037bc0dff2c9c1b8c3c4c2f7905f34d5315
MD5 1bd7387d10f479f005ad7448aeff8a9e
BLAKE2b-256 5029c204c8c80e2525ff2e601a2e87d6df598b76a0b9b738910d045d52f34037

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