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))
|
||||
if err != nil {
|
||||
if err != nil || len(jobs) == 0 {
|
||||
msg := "No jobs found for given session id"
|
||||
slog.Error(msg, "id", variantAnalysisID)
|
||||
http.Error(w, msg, http.StatusNotFound)
|
||||
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.
|
||||
// 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)
|
||||
|
||||
sessionInfo := SessionInfo{
|
||||
// TODO verify: these fields are never used
|
||||
// Owner: "unused",
|
||||
// ControllerRepo: "unused",
|
||||
// Repositories: repoNWOs,
|
||||
// OverLimitRepos: nil, /* FIXME */
|
||||
// AnalysisRepos: analysisRepos,
|
||||
if len(*analysisRepos) == 0 {
|
||||
slog.Warn("No repositories found for analysis")
|
||||
}
|
||||
|
||||
// XX: session_is is separate from the query pack ref. Value may be equal
|
||||
c.startAnalyses(analysisRepos, queryPackLocation, sessionId, queryLanguage)
|
||||
|
||||
sessionInfo := SessionInfo{
|
||||
ID: sessionId,
|
||||
|
||||
QueryPack: strconv.Itoa(sessionId), // TODO
|
||||
Language: queryLanguage,
|
||||
|
||||
AccessMismatchRepos: nil, /* FIXME */
|
||||
NotFoundRepos: notFoundRepos,
|
||||
NoCodeqlDBRepos: nil, /* FIXME */
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
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) {
|
||||
|
||||
@@ -9,17 +9,9 @@ import (
|
||||
)
|
||||
|
||||
type SessionInfo struct {
|
||||
// TODO verify: these fields are never used
|
||||
// Owner string
|
||||
// ControllerRepo string
|
||||
// Repositories []common.NameWithOwner
|
||||
// OverLimitRepos []common.NameWithOwner
|
||||
// AnalysisRepos *map[common.NameWithOwner]qldbstore.CodeQLDatabaseLocation
|
||||
|
||||
ID int
|
||||
QueryPack string
|
||||
Language string
|
||||
|
||||
AccessMismatchRepos []common.NameWithOwner
|
||||
NotFoundRepos []common.NameWithOwner
|
||||
NoCodeqlDBRepos []common.NameWithOwner
|
||||
|
||||
Reference in New Issue
Block a user