# Systemd adaptor job is not timing out

**URL:** <https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183>\
**Category:** Get Help\
**Created:** [April 9, 2025, 4:56pm UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183 "2025-04-09T16:56:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xpillons](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/xpillons/32/1256_2.png) [@xpillons](https://discourse.openondemand.org/u/xpillons)\
**Post date:** [April 9, 2025, 4:56pm UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/1 "2025-04-09T16:56:27Z")

</div>

I’m trying to use the systemd adaptor to run applications on a Slurm cluster login node.  
Below is my cluster definition for such node. I set a timeout of 180s for testing. the documentation says the attribute name is `timeout`. The ood\_core code seems to use a `site_timeout` attribute [ood\_core/lib/ood\_core/job/adapters/systemd/launcher.rb at master · OSC/ood\_core](https://github.com/OSC/ood_core/blob/master/lib/ood_core/job/adapters/systemd/launcher.rb#L25)

I tried both, but my systemd job never get cancelled after 3 minutes.  
Can you please help me troubleshoot and fix this ?

```yml
---
v2:
  metadata:
    title: "Login ccw"
    hidden: true
  job:
    adapter: "systemd"
    submit_host: "ccw-login-1"
    ssh_hosts:
      - ccw-login-1

    timeout: 180 
    strict_host_checking: false
    debug: true

  # Don't show ssh link in batch connect card
  batch_connect:
    ssh_allow: false
    basic:
      script_wrapper: |
        module purge
        %s

```

Thank you,  
Xavier

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 9, 2025, 5:11pm UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/2 "2025-04-09T17:11:39Z")

</div>

That adapter was a community contribution, so I can only guess. But if you have the `debug` flag on, it stands to reason that the resulting `script_wrapper.erb.sh` may exist as a templated sh script. In that script you’ll see how this line was templated. Did it get the correct `RuntimeMaxSec`? Also I think `site_timeout` is the absolute maximum you can request, whereas something like `bc_num_hours` will be the timeout you request for a job and the adapter will choose the smaller of the 2.

> <https://github.com/OSC/ood_core/blob/be9ede986e129da96131ad5ab4506580198a977d/lib/ood_core/job/adapters/systemd/templates/script_wrapper.erb.sh#L53>

---

<div class="post-metadata">

**Author:** ![xpillons](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/xpillons/32/1256_2.png) [@xpillons](https://discourse.openondemand.org/u/xpillons)\
**Post date:** [April 9, 2025, 7:44pm UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/3 "2025-04-09T19:44:42Z")

</div>

Thank you jeff.  
Unfortunately I don’t see the RuntimeMaxSec in any of files generated. I will try using bc\_num\_hours.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 9, 2025, 8:00pm UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/4 "2025-04-09T20:00:39Z")

</div>

Yea again, not super familiar with this adapter, but it seems like while it’s running you should at least be able to query systemd to see information about the unit?

---

<div class="post-metadata">

**Author:** ![xpillons](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/xpillons/32/1256_2.png) [@xpillons](https://discourse.openondemand.org/u/xpillons)\
**Post date:** [April 10, 2025, 9:33am UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/5 "2025-04-10T09:33:39Z")

</div>

using bc\_num\_hours solved it.  
Thanks Jeff

---

<div class="post-metadata">

**Author:** ![xpillons](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/xpillons/32/1256_2.png) [@xpillons](https://discourse.openondemand.org/u/xpillons)\
**Post date:** [April 10, 2025, 12:54pm UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/6 "2025-04-10T12:54:56Z")

</div>

It seems that the cluster level timeout is not working.  
I’ve tried to use various attributes like

- site\_timeout as show in the example [Systemd — Open OnDemand 4.0.0 documentation](https://osc.github.io/ood-documentation/latest/installation/resource-manager/systemd.html)
- timeout as documented [Systemd — Open OnDemand 4.0.0 documentation](https://osc.github.io/ood-documentation/latest/installation/resource-manager/systemd.html)
- max\_timeout as defined here [ood\_core/lib/ood\_core/job/adapters/systemd.rb at master · OSC/ood\_core](https://github.com/OSC/ood_core/blob/master/lib/ood_core/job/adapters/systemd.rb#L19)

I’ve updated [ood\_core/lib/ood\_core/job/adapters/systemd/templates/script\_wrapper.erb.sh at master · OSC/ood\_core](https://github.com/OSC/ood_core/blob/master/lib/ood_core/job/adapters/systemd/templates/script_wrapper.erb.sh) to dump the value of `script_timeout` and it’s always the value of bc\_num\_hours expressed in seconds.

```yml
---
v2:
  metadata:
    title: "Login ccw"
    hidden: true
  job:
    adapter: "systemd"
    submit_host: "ccw-login-1"
    ssh_hosts:
      - ccw-login-1

    site_timeout: 10
    timeout: 10
    max_timeout: 10
    strict_host_checking: false
    debug: true

  # Don't show ssh link in batch connect card
  batch_connect:
    ssh_allow: false
    basic:
      script_wrapper: |
        module purge
        %s

```

any idea what can be wrong here ?  
Thank you  
Xavier

---

<div class="post-metadata">

**Author:** ![ijanarado](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ijanarado/32/2823_2.png) [@ijanarado](https://discourse.openondemand.org/u/ijanarado)\
**Post date:** [July 3, 2025, 9:37am UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/7 "2025-07-03T09:37:56Z")

</div>

Hi Xavier Pillons,

I was wondering if you have been able to setup this adaptor at your site. I’m struggling with getting it up and running, including enforcing memory and cpu limit per user

---

<div class="post-metadata">

**Author:** ![xpillons](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/xpillons/32/1256_2.png) [@xpillons](https://discourse.openondemand.org/u/xpillons)\
**Post date:** [July 8, 2025, 8:08am UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/8 "2025-07-08T08:08:53Z")

</div>

Hi @ijanarado ,  
Yes I have been able to make it works. Please see our implementation details here for the application using it [cyclecloud-open-ondemand/specs/default/cluster-init/files/playbooks/files/applications/systemd\_vscode/form.yml.erb at main · Azure/cyclecloud-open-ondemand](https://github.com/Azure/cyclecloud-open-ondemand/blob/main/specs/default/cluster-init/files/playbooks/files/applications/systemd_vscode/form.yml.erb)  
and here for the cluster definition [cyclecloud-open-ondemand/specs/default/cluster-init/files/playbooks/roles/register\_cluster/templates/login\_cluster.yml.j2 at main · Azure/cyclecloud-open-ondemand](https://github.com/Azure/cyclecloud-open-ondemand/blob/main/specs/default/cluster-init/files/playbooks/roles/register_cluster/templates/login_cluster.yml.j2)

I hope this will help you,  
Best,  
Xavier

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [January 4, 2026, 8:09am UTC](https://discourse.openondemand.org/t/systemd-adaptor-job-is-not-timing-out/4183/9 "2026-01-04T08:09:29Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
