Skip to content

Commit

Permalink
Merge pull request #345 from pixlise/feature/em-import
Browse files Browse the repository at this point in the history
Feature/em import
  • Loading branch information
pnemere authored Nov 7, 2024
2 parents a227328 + c075e98 commit 30633aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 4 additions & 2 deletions api/dataimport/for-trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ func Test_ImportForTrigger_Manual_SBU_NoAutoShare_FailForPipeline(t *testing.T)
}
}
*/
// Import a breadboard dataset from manual uploaded zip file

// DISABLED 5/Nov/2024, rewrite importer for EM to work differently so these tests are no longer relevant. Will have to write new tests for new functionality
/*
func Example_importForTrigger_Manual_EM() {
remoteFS, log, configBucket, datasetBucket, manualBucket, db := initTest("Manual_EM", "ManualEM_OK", specialUserIds.PIXLISESystemUserId, "PIXLFMGroupId")
Expand Down Expand Up @@ -587,7 +589,7 @@ func Example_importForTrigger_Manual_EM_WithBeamV2() {
// Logged "No auto-share destination found, so only importing user will be able to access this dataset.": false
// Logged "Saving as beam geometry tool version: 2": true
// <nil>|{"id":"048300551","title":"048300551","dataTypes":[{"dataType":"SD_IMAGE","count":4},{"dataType":"SD_XRF","count":242}],"instrument":"PIXL_EM","instrumentConfig":"PIXL-EM-E2E","meta":{"DriveId":"1712","RTT":"048300551","SCLK":"678031418","Site":"","SiteId":"4","Sol":"0125","Target":"","TargetId":"?"},"contentCounts":{"BulkSpectra":2,"DwellSpectra":0,"MaxSpectra":2,"NormalSpectra":242,"PseudoIntensities":121},"creatorUserId":"PIXLISEImport"}
}
}*/

/* NOT TESTED YET, because it's not done yet!
Expand Down
2 changes: 2 additions & 0 deletions api/dataimport/sdfToRSI/scanSDF_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package sdfToRSI
import "fmt"

func Example_scanSDF() {
ensureSDFRawExists()

refs, err := scanSDF("./test-data/BadPath.txt")
fmt.Printf("%v|%v\n", len(refs), err)

Expand Down
18 changes: 12 additions & 6 deletions api/dataimport/sdfToRSI/sdfToRSI_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ import (
)

func Example_ConvertSDFtoRSI() {
ensureSDFRawExists()

fmt.Printf("Mkdir output: %v\n", os.MkdirAll("./output", 0644))
files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/")
fmt.Printf("%v, %v: %v\n", files, rtts, err)

// Output:
// Mkdir output: <nil>
// [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: <nil>
}

func ensureSDFRawExists() {
// If it's not here, unzip it
_, err := os.Stat("./test-data/sdf_raw.txt")
if err != nil {
Expand Down Expand Up @@ -39,10 +51,4 @@ func Example_ConvertSDFtoRSI() {
}
}
}

files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/")
fmt.Printf("%v, %v: %v\n", files, rtts, err)

// Output:
// [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: <nil>
}
2 changes: 1 addition & 1 deletion core/mongoDBConnection/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func makeMongoCommandMonitor(log logger.ILogger) *event.CommandMonitor {
log.Debugf("Mongo success:\n%v", evt.CommandFinishedEvent)
},
Failed: func(_ context.Context, evt *event.CommandFailedEvent) {
log.Errorf("Mongo FAIL:\n%v", evt.Failure)
log.Errorf("Mongo err:\n%v", evt.Failure)
},
}
}

0 comments on commit 30633aa

Please sign in to comment.