fix regression from 0cffb3c8
This commit is contained in:
committed by
=Michael Hohn
parent
17bf9049e4
commit
c54bda8432
@@ -216,32 +216,12 @@ func (c *CommanderSingle) MRVAStatusCommon(w http.ResponseWriter, r *http.Reques
|
|||||||
}
|
}
|
||||||
|
|
||||||
jobs, err := c.v.State.GetJobList(int(sessionId))
|
jobs, err := c.v.State.GetJobList(int(sessionId))
|
||||||
if err != nil {
|
if err != nil || len(jobs) == 0 {
|
||||||
msg := "No jobs found for given session id"
|
msg := "No jobs found for given session id"
|
||||||
slog.Error(msg, "id", variantAnalysisID)
|
slog.Error(msg, "id", variantAnalysisID)
|
||||||
http.Error(w, msg, http.StatusNotFound)
|
http.Error(w, msg, http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(jobs) == 0 {
|
|
||||||
// TODO Empty joblist found. Either return an error or a very special response -- there are several special cases to handle.
|
|
||||||
// c.submitStatusResponse(w, job.Spec, jobInfo)
|
|
||||||
slog.Error("TODO empty joblist found", "id", variantAnalysisID)
|
|
||||||
// js := queue.AnalyzeJob{
|
|
||||||
// Spec: common.JobSpec{
|
|
||||||
// SessionID: 0,
|
|
||||||
// NameWithOwner: common.NameWithOwner{
|
|
||||||
// Owner: "no-owner",
|
|
||||||
// Repo: "no-repo",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// QueryPackLocation: artifactstore.ArtifactLocation{
|
|
||||||
// Data: nil,
|
|
||||||
// },
|
|
||||||
// QueryLanguage: "no-querylanguage",
|
|
||||||
// }
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// The status reports one status for all jobs belonging to an id.
|
// The status reports one status for all jobs belonging to an id.
|
||||||
// So we simply report the status of a job as the status of all.
|
// So we simply report the status of a job as the status of all.
|
||||||
@@ -472,21 +452,23 @@ func (c *CommanderSingle) MRVARequestCommon(w http.ResponseWriter, r *http.Reque
|
|||||||
|
|
||||||
notFoundRepos, analysisRepos := c.v.CodeQLDBStore.FindAvailableDBs(repoNWOs)
|
notFoundRepos, analysisRepos := c.v.CodeQLDBStore.FindAvailableDBs(repoNWOs)
|
||||||
|
|
||||||
sessionInfo := SessionInfo{
|
if len(*analysisRepos) == 0 {
|
||||||
// TODO verify: these fields are never used
|
slog.Warn("No repositories found for analysis")
|
||||||
// Owner: "unused",
|
}
|
||||||
// ControllerRepo: "unused",
|
|
||||||
// Repositories: repoNWOs,
|
// XX: session_is is separate from the query pack ref. Value may be equal
|
||||||
// OverLimitRepos: nil, /* FIXME */
|
c.startAnalyses(analysisRepos, queryPackLocation, sessionId, queryLanguage)
|
||||||
// AnalysisRepos: analysisRepos,
|
|
||||||
|
sessionInfo := SessionInfo{
|
||||||
|
ID: sessionId,
|
||||||
|
|
||||||
ID: sessionId,
|
|
||||||
QueryPack: strconv.Itoa(sessionId), // TODO
|
QueryPack: strconv.Itoa(sessionId), // TODO
|
||||||
Language: queryLanguage,
|
Language: queryLanguage,
|
||||||
|
|
||||||
AccessMismatchRepos: nil, /* FIXME */
|
AccessMismatchRepos: nil, /* FIXME */
|
||||||
NotFoundRepos: notFoundRepos,
|
NotFoundRepos: notFoundRepos,
|
||||||
NoCodeqlDBRepos: nil, /* FIXME */
|
NoCodeqlDBRepos: nil, /* FIXME */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Debug("Forming and sending response for submitted analysis job", "id", sessionInfo.ID)
|
slog.Debug("Forming and sending response for submitted analysis job", "id", sessionInfo.ID)
|
||||||
@@ -496,15 +478,9 @@ func (c *CommanderSingle) MRVARequestCommon(w http.ResponseWriter, r *http.Reque
|
|||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.Write(submitResponseJson)
|
w.Write(submitResponseJson)
|
||||||
|
|
||||||
// Start analysis only if repositories were found
|
|
||||||
if len(*analysisRepos) == 0 {
|
|
||||||
slog.Warn("No repositories found for analysis")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.startAnalyses(analysisRepos, queryPackLocation, sessionId, queryLanguage)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CommanderSingle) MRVARequestID(w http.ResponseWriter, r *http.Request) {
|
func (c *CommanderSingle) MRVARequestID(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@@ -9,17 +9,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SessionInfo struct {
|
type SessionInfo struct {
|
||||||
// TODO verify: these fields are never used
|
ID int
|
||||||
// Owner string
|
QueryPack string
|
||||||
// ControllerRepo string
|
Language string
|
||||||
// Repositories []common.NameWithOwner
|
|
||||||
// OverLimitRepos []common.NameWithOwner
|
|
||||||
// AnalysisRepos *map[common.NameWithOwner]qldbstore.CodeQLDatabaseLocation
|
|
||||||
|
|
||||||
ID int
|
|
||||||
QueryPack string
|
|
||||||
Language string
|
|
||||||
|
|
||||||
AccessMismatchRepos []common.NameWithOwner
|
AccessMismatchRepos []common.NameWithOwner
|
||||||
NotFoundRepos []common.NameWithOwner
|
NotFoundRepos []common.NameWithOwner
|
||||||
NoCodeqlDBRepos []common.NameWithOwner
|
NoCodeqlDBRepos []common.NameWithOwner
|
||||||
|
|||||||
Reference in New Issue
Block a user