Skip to content

Commit

Permalink
Merge pull request #241 from pixlise/development
Browse files Browse the repository at this point in the history
Release v4.21.0
  • Loading branch information
pnemere authored Jun 12, 2024
2 parents 01c2120 + 3208330 commit 68a9e7a
Show file tree
Hide file tree
Showing 91 changed files with 666 additions and 552 deletions.
23 changes: 23 additions & 0 deletions api/quantification/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,28 @@
package quantification

import (
"context"
"encoding/json"
"fmt"
"path"
"path/filepath"
"strings"
"sync"

"github.com/pixlise/core/v4/api/dbCollections"
"github.com/pixlise/core/v4/api/filepaths"
"github.com/pixlise/core/v4/api/job"
"github.com/pixlise/core/v4/api/piquant"
"github.com/pixlise/core/v4/api/quantification/quantRunner"
"github.com/pixlise/core/v4/api/services"
"github.com/pixlise/core/v4/api/specialUserIds"
"github.com/pixlise/core/v4/api/ws/wsHelpers"
"github.com/pixlise/core/v4/core/fileaccess"
"github.com/pixlise/core/v4/core/logger"
"github.com/pixlise/core/v4/core/utils"
protos "github.com/pixlise/core/v4/generated-protos"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
)

// JobParamsFileName - File name of job params file
Expand Down Expand Up @@ -382,7 +387,25 @@ func (r *quantNodeRunner) triggerPiquantNodes(wg *sync.WaitGroup) {
},
}

// If we've got a special import that's done by the internal user, we read the owner entry from DB scan auto share table (ScanAutoShareName)
ownerItem := wsHelpers.MakeOwnerForWrite(r.jobId, protos.ObjectType_OT_QUANTIFICATION, r.quantStartSettings.RequestorUserId, now)
if r.quantStartSettings.RequestorUserId == specialUserIds.PIXLISESystemUserId {
coll := svcs.MongoDB.Collection(dbCollections.ScanAutoShareName)
autoShareResult := coll.FindOne(context.TODO(), bson.D{{Key: "_id", Value: r.quantStartSettings.RequestorUserId}}, options.FindOne())
if autoShareResult.Err() != nil {
svcs.Log.Errorf("Failed to read auto-share info for quantification triggered by %v. Quant won't be shared", r.quantStartSettings.RequestorUserId)
} else {
autoEntry := &protos.ScanAutoShareEntry{}
err := autoShareResult.Decode(autoEntry)
if err != nil {
svcs.Log.Errorf("Failed to decode auto-share info for quantification triggered by %v: %v", r.quantStartSettings.RequestorUserId, err)
} else {
svcs.Log.Errorf("Found scan auto-share entry for quantification requestor \"%v\". Sharing accordingly.", r.quantStartSettings.RequestorUserId)
ownerItem.Viewers = autoEntry.Viewers
ownerItem.Editors = autoEntry.Editors
}
}
}

err = writeQuantAndOwnershipToDB(summary, ownerItem, svcs.MongoDB)
if err != nil {
Expand Down
5 changes: 4 additions & 1 deletion api/ws/handlers/image-beam-location.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ func HandleImageBeamLocationsReq(req *protos.ImageBeamLocationsReq, hctx wsHelpe
result := coll.FindOne(ctx, bson.M{"_id": req.ImageName})
if result.Err() != nil {
if result.Err() == mongo.ErrNoDocuments {
return nil, errorwithstatus.MakeNotFoundError(req.ImageName)
// If there are no beam locations, don't return an error, just return a message with no items in it
return &protos.ImageBeamLocationsResp{
Locations: &protos.ImageLocations{ImageName: req.ImageName},
}, nil
}
return nil, result.Err()
}
Expand Down
9 changes: 6 additions & 3 deletions api/ws/handlers/quantification-multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
protos "github.com/pixlise/core/v4/generated-protos"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)

// Anyone can retrieve a quant z-stack if they have quant messaging permissions
Expand Down Expand Up @@ -65,13 +66,15 @@ func HandleQuantCombineListWriteReq(req *protos.QuantCombineListWriteReq, hctx w
List: req.List,
}

result, err := coll.InsertOne(ctx, doc)
opt := options.Update().SetUpsert(true)

result, err := coll.UpdateByID(ctx, zId, bson.D{{Key: "$set", Value: doc}}, opt)
if err != nil {
return nil, err
}

if result.InsertedID != zId {
hctx.Svcs.Log.Errorf("MultiQuant Z-Stack insert %v inserted different id %v", zId, result.InsertedID)
if result.UpsertedCount != 1 {
hctx.Svcs.Log.Errorf("MultiQuant Z-Stack write for: %v got unexpected DB write result: %+v", req.ScanId, result)
}

return &protos.QuantCombineListWriteResp{}, nil
Expand Down
2 changes: 1 addition & 1 deletion data-formats
4 changes: 2 additions & 2 deletions generated-protos/detector-config-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/detector-config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/diffraction-data.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/diffraction-detected-peak-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/diffraction-manual-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/diffraction-status-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/diffraction.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/doi-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/doi.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/element-set-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/element-set.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/experiment.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/export-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/export.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/expression-group-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/expression-group.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/expression-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/expressions.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/image-beam-location-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/image-beam-location.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/image-coreg-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/image-coreg.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/image-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/image.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/job-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/job.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/log-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/log.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/memoisation-msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generated-protos/memoisation.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 68a9e7a

Please sign in to comment.