# Access task's submission time in its job script

**URL:** <https://cylc.discourse.group/t/access-tasks-submission-time-in-its-job-script/1162>\
**Category:** Cylc Support\
**Created:** [April 30, 2025, 5:06pm UTC](https://cylc.discourse.group/t/access-tasks-submission-time-in-its-job-script/1162 "2025-04-30T17:06:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlentz](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jlentz](https://cylc.discourse.group/u/jlentz)\
**Post date:** [April 30, 2025, 5:06pm UTC](https://cylc.discourse.group/t/access-tasks-submission-time-in-its-job-script/1162/1 "2025-04-30T17:06:56Z")

</div>

Hello,

I have a use case for which it would be useful to know, in a task’s job script or in its prescript, the wall-clock time at which the task was submitted to the scheduler. Is this possible in cylc (8.3.5)?

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![hilary.j.oliver](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/hilary.j.oliver/32/4_2.png) [@hilary.j.oliver](https://cylc.discourse.group/u/hilary.j.oliver)\
**Post date:** [April 30, 2025, 7:24pm UTC](https://cylc.discourse.group/t/access-tasks-submission-time-in-its-job-script/1162/2 "2025-04-30T19:24:58Z")

</div>

Hi @jlentz,

The easiest way to get job submit time from within the job itself, I think, would be to read the `job.status` file that is written automatically by every Cylc job, in the job log directory on the job host.

(You can print job status files with `cylc cat-log -f s`, or look in the task log directory).

Conveniently, the file content looks like bash-format variable assignments already, so you can simply `eval` the lot. Example:

```ini
[scheduling]
    [[graph]]
        R1 = foo
[runtime]
    [[foo]]
        script = """
            eval $(cat "${CYLC_TASK_LOG_DIR}/job.status")
            echo "My submit time is $CYLC_JOB_RUNNER_SUBMIT_TIME"
        """

```

Result:

```console
$ cylc cat-log test//1/foo

Workflow : test/run22
Job : 1/foo/01 (try 1)
User@Host: oliver@slayer.local

My submit time is 2025-05-01T07:12:45+12:00

2025-05-01T07:12:46+12:00 INFO - started
2025-05-01T07:12:46+12:00 INFO - succeeded

```

---

<div class="post-metadata">

**Author:** ![jlentz](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jlentz](https://cylc.discourse.group/u/jlentz)\
**Post date:** [April 30, 2025, 9:38pm UTC](https://cylc.discourse.group/t/access-tasks-submission-time-in-its-job-script/1162/3 "2025-04-30T21:38:43Z")

</div>

Thanks very much for the answer Hilary!

I have one follow-up question. What I’m really interested in is the time at which all of the present task’s dependencies have completed (for which I believe the submission time should be a good proxy). Is it correct to assume that the `job` file (in the present task’s `CYLC_TASK_LOG_DIR`) is always created after all the dependencies have completed?

---

<div class="post-metadata">

**Author:** ![hilary.j.oliver](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/hilary.j.oliver/32/4_2.png) [@hilary.j.oliver](https://cylc.discourse.group/u/hilary.j.oliver)\
**Post date:** [May 1, 2025, 3:51am UTC](https://cylc.discourse.group/t/access-tasks-submission-time-in-its-job-script/1162/4 "2025-05-01T03:51:12Z")

</div>

No, the job file is written at the last moment just before job submission.

Job submit time may not be a good proxy for dependencies getting satisfied if:

- you have any Cylc queues actively limiting job submissions
- or if the subprocess pool, which handles job submission, event handlers, etc., is rammed

If you really want the time at which the last dependency was satisfied you’ll need to scrape the scheduler log for completion of the associated outputs, or query the same in the scheduler run database (sqlite) - both on the scheduler host, not the job host (if they differ).
