Skip to content

Commit

Permalink
fix: correctly shutdown xcom after job is complete
Browse files Browse the repository at this point in the history
I got the following logs when using the original statement

```
docker run -u 1000 -it alpine sh # alpine container seems to be run under uid 1000 in kubernetes
sh -c trap "exit 0" INT; while true; do sleep 1; done;
````

```
kill -2 $(pgrep -u $(whoami) -f 'trap')
```

```
whoami
whoami: unknown uid 1000
```

```
pgrep -f 'trap' # returns no processes
```

instead with:

```
kill -2 $(pgrep -u $(id -u) -f 'sh')
```

Signed-off-by: Kasper J. Hermansen <[email protected]>
  • Loading branch information
kjuulh committed Jan 7, 2025
1 parent a6da8df commit 0023903
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def extract_xcom_kill(self, pod: V1Pod):
_preload_content=False,
)
) as resp:
self._exec_pod_command(resp, "kill -2 $(pgrep -u $(whoami) -f trap)")
self._exec_pod_command(resp, "kill -2 $(pgrep -u $(id -u) -f 'sh')")

def _exec_pod_command(self, resp, command: str) -> str | None:
res = ""
Expand Down

0 comments on commit 0023903

Please sign in to comment.