wip: rename ID to JobId

This commit is contained in:
Michael Hohn
2024-06-04 13:04:51 -07:00
committed by =Michael Hohn
parent 0349961360
commit 593644ca2e
4 changed files with 12 additions and 11 deletions

View File

@@ -40,6 +40,7 @@ Steps to build and run the server in a multi-container environment set up by doc
1. Start the containers 1. Start the containers
cd ~/work-gh/mrva/mrvacommander/ cd ~/work-gh/mrva/mrvacommander/
docker-compose down
docker-compose up -d docker-compose up -d
4. Run server in its container 4. Run server in its container

View File

@@ -47,6 +47,6 @@ func (s Status) ToExternalString() string {
} }
type JobSpec struct { type JobSpec struct {
ID int JobID int
OwnerRepo OwnerRepo
} }

View File

@@ -62,9 +62,9 @@ func (c *CommanderSingle) StatusResponse(w http.ResponseWriter, js common.JobSpe
slog.Debug("Submitting status response", "session", vaid) slog.Debug("Submitting status response", "session", vaid)
all_scanned := []common.ScannedRepo{} all_scanned := []common.ScannedRepo{}
jobs := storage.GetJobList(js.ID) jobs := storage.GetJobList(js.JobID)
for _, job := range jobs { for _, job := range jobs {
astat := storage.GetStatus(js.ID, job.ORL).ToExternalString() astat := storage.GetStatus(js.JobID, job.ORL).ToExternalString()
all_scanned = append(all_scanned, all_scanned = append(all_scanned,
common.ScannedRepo{ common.ScannedRepo{
Repository: common.Repository{ Repository: common.Repository{
@@ -82,10 +82,10 @@ func (c *CommanderSingle) StatusResponse(w http.ResponseWriter, js common.JobSpe
) )
} }
astat := storage.GetStatus(js.ID, js.OwnerRepo).ToExternalString() astat := storage.GetStatus(js.JobID, js.OwnerRepo).ToExternalString()
status := common.StatusResponse{ status := common.StatusResponse{
SessionId: js.ID, SessionId: js.JobID,
ControllerRepo: common.ControllerRepo{}, ControllerRepo: common.ControllerRepo{},
Actor: common.Actor{}, Actor: common.Actor{},
QueryLanguage: ji.QueryLanguage, QueryLanguage: ji.QueryLanguage,
@@ -142,7 +142,7 @@ func (c *CommanderSingle) MirvaStatus(w http.ResponseWriter, r *http.Request) {
job := spec[0] job := spec[0]
js := common.JobSpec{ js := common.JobSpec{
ID: job.QueryPackId, JobID: job.QueryPackId,
OwnerRepo: job.ORL, OwnerRepo: job.ORL,
} }
@@ -169,7 +169,7 @@ func (c *CommanderSingle) MirvaDownloadArtifact(w http.ResponseWriter, r *http.R
return return
} }
js := common.JobSpec{ js := common.JobSpec{
ID: vaid, JobID: vaid,
OwnerRepo: common.OwnerRepo{ OwnerRepo: common.OwnerRepo{
Owner: vars["repo_owner"], Owner: vars["repo_owner"],
Repo: vars["repo_name"], Repo: vars["repo_name"],
@@ -366,7 +366,7 @@ func submit_response(sn SessionInfo) ([]byte, error) {
for _, job := range joblist { for _, job := range joblist {
storage.SetJobInfo(common.JobSpec{ storage.SetJobInfo(common.JobSpec{
ID: sn.ID, JobID: sn.ID,
OwnerRepo: job.ORL, OwnerRepo: job.ORL,
}, common.JobInfo{ }, common.JobInfo{
QueryLanguage: sn.Language, QueryLanguage: sn.Language,

View File

@@ -125,7 +125,7 @@ func GetResult(js common.JobSpec) common.AnalyzeResult {
func SetResult(sessionid int, orl common.OwnerRepo, ar common.AnalyzeResult) { func SetResult(sessionid int, orl common.OwnerRepo, ar common.AnalyzeResult) {
mutex.Lock() mutex.Lock()
defer mutex.Unlock() defer mutex.Unlock()
result[common.JobSpec{ID: sessionid, OwnerRepo: orl}] = ar result[common.JobSpec{JobID: sessionid, OwnerRepo: orl}] = ar
} }
func PackageResults(ar common.AnalyzeResult, owre common.OwnerRepo, vaid int) (zipPath string, e error) { func PackageResults(ar common.AnalyzeResult, owre common.OwnerRepo, vaid int) (zipPath string, e error) {
@@ -206,7 +206,7 @@ func SetJobInfo(js common.JobSpec, ji common.JobInfo) {
func GetStatus(sessionid int, orl common.OwnerRepo) common.Status { func GetStatus(sessionid int, orl common.OwnerRepo) common.Status {
mutex.Lock() mutex.Lock()
defer mutex.Unlock() defer mutex.Unlock()
return status[common.JobSpec{ID: sessionid, OwnerRepo: orl}] return status[common.JobSpec{JobID: sessionid, OwnerRepo: orl}]
} }
func ResultAsFile(path string) (string, []byte, error) { func ResultAsFile(path string) (string, []byte, error) {
@@ -227,7 +227,7 @@ func ResultAsFile(path string) (string, []byte, error) {
func SetStatus(sessionid int, orl common.OwnerRepo, s common.Status) { func SetStatus(sessionid int, orl common.OwnerRepo, s common.Status) {
mutex.Lock() mutex.Lock()
defer mutex.Unlock() defer mutex.Unlock()
status[common.JobSpec{ID: sessionid, OwnerRepo: orl}] = s status[common.JobSpec{JobID: sessionid, OwnerRepo: orl}] = s
} }
func AddJob(sessionid int, job common.AnalyzeJob) { func AddJob(sessionid int, job common.AnalyzeJob) {