Skip to content

Commit

Permalink
[antlir systemd timer API] Stop hard coding TimeoutStartSec=15min a…
Browse files Browse the repository at this point in the history
…nd make it configurable

Summary:
I realised, when I created this API, that I had hard coded this...
Let's make this configurable.

Test Plan:
I kept the public facing macro defaulting to 15m so this will be a NOOP as I manually tested:

```
# pallotron @ devvm3927 in ~/fbcode [0:26:16]
$ buck run '//netos/os:os[container]'
File changed: fbcode//antlir/bzl/linux/systemd/service_unit.jinja2
File changed: fbcode//antlir/bzl/linux/systemd
File changed: fbcode//antlir/bzl
3 additional file change events
Buck UI: https://www.internalfb.com/buck2/29417122-84a5-4da1-b482-c554323a5edb
Network: Up: 4.9MiB  Down: 5.7GiB  (reSessionID-927494fa-ef86-4736-9947-81106077633f)
Analyzing targets. Remaining     0/101                                                                                                           7 actions
Executing actions. Remaining     0/45605                                                                                                         56:13:47.2s exec time total
Command: run.      Finished 63 local, 168 remote, 42119 cache (99% hit)                                                                          55:48:28.4s exec time cached (99%)
Time elapsed: 4:15.1s
BUILD SUCCEEDED
bash-5.1#
```

```
bash-5.1# cat /usr/lib/systemd/system/fb_procprint.service  | grep TimeoutStart
TimeoutStartSec=15m
```

Reviewed By: lsiudut

Differential Revision: D68008374

fbshipit-source-id: 891db5b23a63ab47a687ef04c02e45c6ea7e8e0d
  • Loading branch information
pallotron authored and facebook-github-bot committed Jan 10, 2025
1 parent fe790fc commit 452d6c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion antlir/bzl/linux/systemd/service_unit.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ EnvironmentFile={{ environment_file }}
{% for cmd in exec_start %}
ExecStart={{ cmd }}
{% endfor %}
TimeoutStartSec=15min
{% if timeout_start %}
TimeoutStartSec={{ timeout_start }}
{% endif %}
TimeoutStopSec=90s
{% for key, val in environment.items() %}
Environment={{ key }}={{ val }}
Expand Down
1 change: 1 addition & 0 deletions antlir/bzl/linux/systemd/systemd.shape.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ service_t = shape.shape(
environment = shape.field(shape.dict(str, str), optional = True),
exec_start = shape.field(shape.list(str), optional = True),
standard_output = shape.field(str, optional = True),
timeout_start = shape.field(str, optional = True),
)

timer_t = shape.shape(
Expand Down

0 comments on commit 452d6c1

Please sign in to comment.