-
Notifications
You must be signed in to change notification settings - Fork 1
save mps features into db #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3d3f60a
dcda8cc
894783f
aae88c0
a86c349
08ae67d
43d10f3
bc63f4e
6be4cae
68ccbf7
f643ae2
b342815
296b6db
655ec6d
86d9afc
ab2e005
8d6faae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: build docker image and publish to ghcr | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - mps-fix | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Get short SHA | ||
| id: vars | ||
| run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./cloud_webserver_v2 | ||
| file: ./cloud_webserver_v2/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ghcr.io/hytech-racing/data_acq_cloud:latest | ||
| ghcr.io/hytech-racing/data_acq_cloud:${{ steps.vars.outputs.SHORT_SHA }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,6 +285,11 @@ func (h *mcapHandler) ProcessMatlabJob(w http.ResponseWriter, r *http.Request) * | |
| } | ||
| scripts := strings.Split(scriptsParam, ",") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dy want me to rename the query param too or just the variable? |
||
|
|
||
| versionParam := r.URL.Query().Get("version") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the matlab scripts will all be packaged together into 1 package to be deployed onto MPS. version refers to the package version |
||
| if versionParam == "" { | ||
| return NewHandlerError("invalid request, must pass in archive version in query params", http.StatusBadRequest) | ||
| } | ||
|
|
||
| mcapId := chi.URLParam(r, "id") | ||
| if mcapId == "" { | ||
| return NewHandlerError("invalid request, must pass in mcap id", http.StatusBadRequest) | ||
|
|
@@ -310,12 +315,8 @@ func (h *mcapHandler) ProcessMatlabJob(w http.ResponseWriter, r *http.Request) * | |
| return NewHandlerError("no h5 files found", http.StatusFailedDependency) | ||
| } | ||
|
|
||
| // TODO: check if matfile exists on filesystem, if not download it from S3 | ||
| // currently assume it exists on filesystem | ||
| for _, matFile := range matFiles { | ||
| for _, script := range scripts { | ||
| h.mpsClient.SubmitMatlabJob(matFile.FileName, script, script) | ||
| } | ||
| for _, script := range scripts { | ||
| h.mpsClient.SubmitMatlabJob(ctx, h.s3Repository, mcapId, versionParam, script) | ||
| } | ||
|
|
||
| render.JSON(w, r, "jobs submitted") | ||
|
|
@@ -349,16 +350,18 @@ func (h *mcapHandler) UpdateMetadataRecordFromID(w http.ResponseWriter, r *http. | |
|
|
||
| for key, values := range r.Form { | ||
| if strings.HasPrefix(key, "mps.") { | ||
| mpsmetadata := make(map[string]interface{}) | ||
| mpsmetadata[strings.TrimPrefix(key, "mps.")] = values[0] | ||
| // TODO: Figure out if updating MPS with an HTTP request is needed | ||
|
|
||
| if runModel.MpsRecord == nil { | ||
| runModel.MpsRecord = make(map[string]interface{}) | ||
| } | ||
| // mpsMetadata := make(map[string]interface{}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls remove unused comments
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, was gonna ask you abt this actually. we need to leave the commented code in if we wanted to be able to update MPS records with an HTTP request to the server. i personally don't want to have that functionality but what do you think |
||
| // mpsMetadata[strings.TrimPrefix(key, "mps.")] = values[0] | ||
|
|
||
| for function, record := range mpsmetadata { | ||
| runModel.MpsRecord[function] = record | ||
| } | ||
| // if runModel.MpsRecord == nil { | ||
| // runModel.MpsRecord = make(map[string]models.MpsScripts) | ||
| // } | ||
|
|
||
| // for function, record := range mpsMetadata { | ||
| // runModel.MpsRecord[function] = record | ||
| // } | ||
| } else { | ||
| switch key { | ||
| case "date": | ||
|
|
@@ -419,8 +422,9 @@ func (h *mcapHandler) ResetMetadataRecordFromID(w http.ResponseWriter, r *http.R | |
| runModel.Location = nil | ||
| case "event_type": | ||
| runModel.EventType = nil | ||
| case "mps_record": | ||
| runModel.MpsRecord = make(map[string]interface{}) | ||
| // TODO: Figure out if updating MPS with an HTTP request is needed | ||
| // case "mps_record": | ||
| // runModel.MpsRecord = make(map[string]interface{}) | ||
| case "car_model": | ||
| runModel.CarModel = "" | ||
| default: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need
mps-fixpost merge?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, i will remove later