MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / doTerminateJobManager

Function doTerminateJobManager

pkg/jobcontroller/jobcontroller.go:940–962  ·  view source on GitHub ↗
(ctx context.Context, jobId string)

Source from the content-addressed store, hash-verified

938}
939
940func doTerminateJobManager(ctx context.Context, jobId string) error {
941 var shouldTerminate bool
942 var job *waveobj.Job
943 err := wstore.DBUpdateFn(ctx, jobId, func(j *waveobj.Job) {
944 job = j
945 if j.JobManagerStatus == JobManagerStatus_Done {
946 shouldTerminate = false
947 return
948 }
949 j.TerminateOnReconnect = true
950 shouldTerminate = true
951 })
952 if err != nil {
953 return fmt.Errorf("failed to set TerminateOnReconnect: %w", err)
954 }
955
956 if !shouldTerminate {
957 log.Printf("[job:%s] already terminated, skipping", jobId)
958 return nil
959 }
960
961 return remoteTerminateJobManager(ctx, job)
962}
963
964func DisconnectJob(ctx context.Context, jobId string) error {
965 job, err := wstore.DBMustGet[*waveobj.Job](ctx, jobId)

Callers 1

TerminateJobManagerFunction · 0.85

Calls 2

DBUpdateFnFunction · 0.92

Tested by

no test coverage detected