Both good questions, thank you!

On Fri, Sep 27, 2024 at 4:45 AM Kosta Harlan <kharlan@wikimedia.org> wrote:
Thanks Reuven! Two questions:

  • Is there a Wikitech page with this information? (I did not find one)

I expect to have Wikitech updated today -- finishing up the text now, sorry about the delay.
 
  • Is there a mwscript-k8s  equivalent to Ctrl-c with the old style maintenance script runner, if you need to stop the script?

Once the job is launched with mwscript-k8s, you can use Kubernetes's standard kubectl commands to interact with it. In this case, delete the job, which sends a SIGTERM to the running script.

  $ kube_env mw-script-deploy codfw  # Act as the deploy user to get delete privileges; use caution
  $ kubectl get job -l username=kharla  # Look up the job name, if you don't have it handy
  $ kubectl delete job ${JOB_NAME}

mwscript-k8s prints out the job name when it starts -- it'll look like "mw-script.codfw.1234wxyz" with a random alphanumeric component at the end.

Note that deleting the job will not only terminate it, but, well, delete it. That includes deleting its saved logs -- so capture those first if you need to keep them.