runpod / runpodctl

🧰 | RunPod CLI for pod management
https://www.runpod.io/
GNU General Public License v3.0
262 stars 37 forks source link

Inconsistent Working Directory Behavior Between Development and Production for projects #173

Open TimPietruskyRunPod opened 4 weeks ago

TimPietruskyRunPod commented 4 weeks ago

There's an inconsistency in how working directories are handled between development (runpodctl project dev) and production (runpodctl project deploy / runpodctl project build) environments, which forces developers to implement path resolution workarounds in their handlers.

Current Behavior

  1. In Development:

    • Working directory is set to project root: /runpod-volume/{uuid}/dev/<project>
    • Project structure is maintained (e.g., src/ directory)
    • Files can be accessed using paths relative to project root
  2. In Production:

    • Working directory is changed to the handler's directory: /runpod-volume/{uuid}/prod/<project>/src
    • Forces developers to use different path resolution for asset files that exist directly in the repo

Current Workaround

Developers must add path resolution code to their handlers, for example to load a model that is part of same repo as the worker:

import os
current_dir = os.path.dirname(os.path.abspath(file))
model_path = os.path.join(current_dir, "<model>.pth")

Expected Behavior

The working directory should be consistent between development and production environments. Either:

  1. Always set working directory to project root
  2. Provide environment variables for important paths
  3. Document a clear convention for file locations and path resolution

Impact