Code Monkey home page Code Monkey logo

Comments (11)

andrewsykim avatar andrewsykim commented on June 27, 2024

RayJob works best for running ephemeral clusters that are cleaned up after running a single job.

However, if you want to run additional jobs on the same RayCluster used for a RayJob, you can just use Ray CLI to submit new jobs:

ray job submit --address <address of the RayCluster from RayJob> --working-dir . -- python myjob.py

from kuberay.

andrewsykim avatar andrewsykim commented on June 27, 2024

In our ML platform, we want to enable users to run their jobs using our CLI. On the backend, we want to leverage the RayJob manifest to create the Ray cluster for them and then run their job on it.

@aybidi if you're users are looking to submit adhoc jobs to a cluster, I think you're better off creating RayClusters for them instead of using RayJob.

from kuberay.

aybidi avatar aybidi commented on June 27, 2024

Our use case is also ephemeral. We want the users to run a command like $ <our-cli> submit job and, in the backend, (i) create a cluster, (ii) run the job, and (iii) delete the cluster.

Right now, we achieve it using RayCluster manifest (to create the cluster) and JobSubmissionClient to submit the job to it. We want to, however, replace the JobSubmissionClient and switch to using the RayJob manifest.

from kuberay.

aybidi avatar aybidi commented on June 27, 2024

Also please let me know if you need more context -- happy to discuss it

from kuberay.

andrewsykim avatar andrewsykim commented on June 27, 2024

Right now, we achieve it using RayCluster manifest (to create the cluster) and JobSubmissionClient to submit the job to it. We want to, however, replace the JobSubmissionClient and switch to using the RayJob manifest.

Ah, gotcha -- sorry for misunderstanding.

It sounds like you just need to convert the $ <our-cli> submit job call into a RayJob. The rayClusterSpec field would be the same as the existing RayCluster you're using. You'll need to update the RayJob entrypoint field to whatever the user specified in $ <our-cli> submit job. Hope that helps answer your question

from kuberay.

aybidi avatar aybidi commented on June 27, 2024

Thanks for the reply! We have figured out that bit (creating a cluster and setting the entrypoint).

We're struggling to understand how users can upload their local working dir to the Ray cluster created. Using JobSubmissionClient, the working_dir in the runtime_env refers to the local directory and gets uploaded to the head node. However, when we use RayJob manifest with the runtimeEnvYAML like so:

apiVersion: ray.io/v1
kind: RayJob
metadata:
  name: rayjob-sample
spec:
  entrypoint: python /home/ray/samples/sample_code.py
  runtimeEnvYAML: |
    working_dir: ...

it expects the working_dir to be an existing directory in the cluster (head node's main container).

from kuberay.

andrewsykim avatar andrewsykim commented on June 27, 2024

it expects the working_dir to be an existing directory in the cluster (head node's main container).

I don't think this is supported. RayJob assumes the source code is available inside the container. It can reference remote zip files though (example), so maybe you can add some logic in your CLI to upload the local working directory and reference it in the RayJob? @kevin85421 do you know if there's any other workaround?

from kuberay.

aybidi avatar aybidi commented on June 27, 2024

providing some more context:

So if a user has a bunch of scripts in their local dev environment:

configs/
    |---- custom-config.yaml
src/
    |---- train.py
    |---- process.py
    |---- eval.py
    |---- main.py

and they want to run $ <our-cli> submit job --config configs/custom-config.yaml -- python src/main.py, we want to prepare the RayJob CR for them using the custom-config.yaml and then submit the RayJob CR. The issue here is that the src/ files may not exist on the Ray cluster that will be created. This wasn't an issue using JobSubmissionClient because the client uploads the src/ to the head node using an HTTP request.

from kuberay.

aybidi avatar aybidi commented on June 27, 2024

Online examples in your samples suggest creating a ConfigMap object to store the scripts and then mounting it onto the container. We can create multiple key-value pairs (one for each file name and its content) in a single ConfigMap.

from kuberay.

andrewsykim avatar andrewsykim commented on June 27, 2024

Online examples in your samples suggest creating a ConfigMap object to store the scripts and then mounting it onto the container. We can create multiple key-value pairs (one for each file name and its content) in a single ConfigMap.

The ConfigMap was just used as an example but I don't think we would recommend this for real world use-cases (@kevin85421 correct me if I'm wrong). As soon as you need to reference multiple files / dependencies it wouldn't scale well.

I think your best bet is to add logic in your internal tool to upload remote zip of the working directory or upload a new container image that includes your local change.

from kuberay.

HCharlie avatar HCharlie commented on June 27, 2024

I see in the rayjob entrypoint, user could clone a project and run it. But I am not sure if there's GitHub Enterprise integration with Rayjob to make Rayjob easier to use. @andrewsykim , do you know if it's supported?

from kuberay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.