MCPcopy
hub / github.com/mudler/LocalAI / saveJobState

Method saveJobState

core/services/quantization/service.go:104–121  ·  view source on GitHub ↗

saveJobState persists a job's state to disk as state.json.

(job *schema.QuantizationJob)

Source from the content-addressed store, hash-verified

102
103// saveJobState persists a job's state to disk as state.json.
104func (s *QuantizationService) saveJobState(job *schema.QuantizationJob) {
105 dir := s.jobDir(job.ID)
106 if err := os.MkdirAll(dir, 0750); err != nil {
107 xlog.Error("Failed to create quantization job directory", "job_id", job.ID, "error", err)
108 return
109 }
110
111 data, err := json.MarshalIndent(job, "", " ")
112 if err != nil {
113 xlog.Error("Failed to marshal quantization job state", "job_id", job.ID, "error", err)
114 return
115 }
116
117 statePath := filepath.Join(dir, "state.json")
118 if err := os.WriteFile(statePath, data, 0640); err != nil {
119 xlog.Error("Failed to write quantization job state", "job_id", job.ID, "error", err)
120 }
121}
122
123// loadJobsFromDisk scans the quantization directory for persisted jobs and
124// returns them. It is the SyncedMap Loader used in standalone mode (no DB); the

Callers 6

StartJobMethod · 0.95
StopJobMethod · 0.95
StreamProgressMethod · 0.95
ImportModelMethod · 0.95
setImportMessageMethod · 0.95
setImportFailedMethod · 0.95

Calls 2

jobDirMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected