# JobSubmission API Taking more time

**URL:** https://discuss.ray.io/t/jobsubmission-api-taking-more-time/11160
**Category:** Ray Client
**Created:** [June 26, 2023, 4:04am UTC](https://discuss.ray.io/t/jobsubmission-api-taking-more-time/11160 "2023-06-26T04:04:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shyampatel](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@shyampatel](https://discuss.ray.io/u/shyampatel)
#### Post date: [June 26, 2023, 4:04am UTC](https://discuss.ray.io/t/jobsubmission-api-taking-more-time/11160/1 "2023-06-26T04:04:54Z")

</div>

Hi,

I am using following code to submit a job to ray cluster:

```auto
import ray
from datetime import datetime
from ray.job_submission import JobSubmissionClient
client = JobSubmissionClient("http://10.60.60.41:8265")
run_script = 'python3 main.py '
job_id = client.submit_job(entrypoint=run_script, runtime_env={"working_dir":"../src/"})
print(datetime.now().strftime("%Y-%m-%d-%T"), job_id)

```

Here, after submitting the job, I am printing time and also printing time in first line in `main.py`. So I have analyzed that it’s taking around 8 seconds after job\_submit to execute the `main.py` file. Even I have check log file (job-driver-raysubmit\_\*.log), in that also I found 8 seconds gap between timestamp of logs and job\_submit time.

I am using cluster.yaml to start cluster and all nodes are on-premises only.

Things checked:

- In all nodes, time is in sync.

Can anyone please explain why it’s taking this much time?

---

<div class="post-metadata">

### Author: ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)
#### Post date: [June 26, 2023, 9:47pm UTC](https://discuss.ray.io/t/jobsubmission-api-taking-more-time/11160/2 "2023-06-26T21:47:06Z")

</div>

@shyampatel job submission will do some preparation works before starting to run the actual code.

Things like:

- create a coordinator Actor
- uploading the working dir and downloading it
- preparing the environment.

All these takes time. If you want it to be as fast as possible, maybe you should run it with a driver directly and avoid using runtime env and instead putting the dir into all nodes.

---

<div class="post-metadata">

### Author: ![shyampatel](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@shyampatel](https://discuss.ray.io/u/shyampatel)
#### Post date: [June 27, 2023, 4:07am UTC](https://discuss.ray.io/t/jobsubmission-api-taking-more-time/11160/3 "2023-06-27T04:07:04Z")

</div>

@yic Thanks for your reply. Yes we have tried putting working dir into all nodes to reduce uploading and downloading time. Can you please elaborate the idea of

> [@yic](#):
>
> you should run it with a driver directly

?

---

<div class="post-metadata">

### Author: ![shyampatel](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@shyampatel](https://discuss.ray.io/u/shyampatel)
#### Post date: [July 21, 2023, 4:05am UTC](https://discuss.ray.io/t/jobsubmission-api-taking-more-time/11160/4 "2023-07-21T04:05:24Z")

</div>

@yic Can you please give suggestion on this?
