Spaces:
Runtime error
Runtime error
File size: 837 Bytes
857a91b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | package cache
import (
"os"
"path/filepath"
)
// ArtifactDir returns (creating if needed) a per-job artifact directory.
func (l *Layout) ArtifactDir(jobID string) (string, error) {
dir := filepath.Join(l.Jobs(), jobID, "artifacts")
if err := os.MkdirAll(dir, 0o755); err != nil {
return "", err
}
return dir, nil
}
// MCPScratchDir returns (creating if needed) a temporary working directory for
// an MCP sandbox keyed by job ID.
func (l *Layout) MCPScratchDir(jobID string) (string, error) {
dir := filepath.Join(l.MCP(), jobID)
if err := os.MkdirAll(dir, 0o700); err != nil {
return "", err
}
return dir, nil
}
// RemoveJob deletes all scratch and artifact data for a job.
func (l *Layout) RemoveJob(jobID string) {
_ = os.RemoveAll(filepath.Join(l.MCP(), jobID))
_ = os.RemoveAll(filepath.Join(l.Jobs(), jobID))
}
|