Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
AquiGorka committed Jun 26, 2024
1 parent 27b906f commit f784b48
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/testnet_deploy_services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- gorka/debug-job-creator

jobs:
solver-build-deploy:
Expand Down
4 changes: 4 additions & 0 deletions pkg/jobcreator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ func (controller *JobCreatorController) subscribeToSolver() error {
controller.log.Error("solver event", fmt.Errorf("RP received nil job offer"))
return
}
metricsDashboard.TrackJobOfferUpdate(*ev.JobOffer)
for _, sub := range controller.jobOfferSubscriptions {
fmt.Println("===================")
fmt.Println("Calling the subscriptions")
fmt.Println("===================")
go sub(*ev.JobOffer)
}
}
Expand Down
10 changes: 9 additions & 1 deletion pkg/jobcreator/onchain_jobcreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@ func (jobCreator *OnChainJobCreator) Start(ctx context.Context, cm *system.Clean
return errorChan
}

jobCreator.SubscribeToJobOfferUpdates(metricsDashboard.TrackJobOfferUpdate)
//jobCreator.SubscribeToJobOfferUpdates(metricsDashboard.TrackJobOfferUpdate)

jobCreator.controller.SubscribeToJobOfferUpdates(func(evOffer data.JobOfferContainer) {

fmt.Printf(" --------------------------------------\n")
fmt.Printf(" --------------------------------------\n")
spew.Dump(evOffer)
fmt.Printf(" --------------------------------------\n")
fmt.Printf(" --------------------------------------\n")
metricsDashboard.TrackJobOfferUpdate(evOffer)

if evOffer.State != data.GetAgreementStateIndex("ResultsAccepted") {
return
}
Expand Down
21 changes: 20 additions & 1 deletion pkg/metricsDashboard/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"time"

"github.com/davecgh/go-spew/spew"
"github.com/lilypad-tech/lilypad/pkg/data"
)

Expand All @@ -16,13 +17,24 @@ const nodeInfoEndpoint = "nodes"
const nodeConnectionEndpoint = "uptimes"
const dealsEndpoint = "deals"

var host = os.Getenv("API_HOST")

func trackEvent(path string, json string) {
var host = os.Getenv("API_HOST")
fmt.Println("===========<<")
fmt.Println()
fmt.Println(host, json)
fmt.Println()
fmt.Println("===========<<")
if host == "" {
return
}

fmt.Println("===========>>")
fmt.Println()
var url = host + "metrics-dashboard/" + path
fmt.Println()
fmt.Println("===========>>")
fmt.Println(url)

data := []byte(json)

Expand All @@ -39,6 +51,13 @@ func trackEvent(path string, json string) {
}

func TrackJobOfferUpdate(evOffer data.JobOfferContainer) {
fmt.Println("===========")
fmt.Println()
fmt.Println("TrackJobOfferUpdate")
fmt.Println(evOffer)
spew.Dump(evOffer)
fmt.Println()
fmt.Println("===========")
var module = evOffer.JobOffer.Module.Name
if module == "" {
module = evOffer.JobOffer.Module.Repo + ":" + evOffer.JobOffer.Module.Hash
Expand Down

0 comments on commit f784b48

Please sign in to comment.