Make the scouting background scraper more generic
We're already using the code for more than just scraping The Blue
Alliance. I'd like to expand it to even more use cases. This patch
moves the code into a more appropriate directory and changes the
module name correspondingly.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Ic0288231f9c0d12f682eb75ac265f090d1ce9165
diff --git a/scouting/webserver/BUILD b/scouting/webserver/BUILD
index 934b50a..f5b0a81 100644
--- a/scouting/webserver/BUILD
+++ b/scouting/webserver/BUILD
@@ -7,8 +7,8 @@
target_compatible_with = ["@platforms//cpu:x86_64"],
visibility = ["//visibility:private"],
deps = [
+ "//scouting/background_task",
"//scouting/db",
- "//scouting/scraping/background",
"//scouting/webserver/driver_ranking",
"//scouting/webserver/match_list",
"//scouting/webserver/rankings",
diff --git a/scouting/webserver/main.go b/scouting/webserver/main.go
index 1b5a002..ba9d120 100644
--- a/scouting/webserver/main.go
+++ b/scouting/webserver/main.go
@@ -14,8 +14,8 @@
"syscall"
"time"
+ "github.com/frc971/971-Robot-Code/scouting/background_task"
"github.com/frc971/971-Robot-Code/scouting/db"
- "github.com/frc971/971-Robot-Code/scouting/scraping/background"
"github.com/frc971/971-Robot-Code/scouting/webserver/driver_ranking"
"github.com/frc971/971-Robot-Code/scouting/webserver/match_list"
"github.com/frc971/971-Robot-Code/scouting/webserver/rankings"
@@ -141,17 +141,17 @@
// Since Go doesn't support default arguments, we use 0 and "" to
// indicate that we want to source the values from the config.
- matchListScraper := background.BackgroundScraper{}
+ matchListScraper := background_task.BackgroundTask{}
matchListScraper.Start(func() {
match_list.GetMatchList(database, 0, "", *blueAllianceConfigPtr)
})
- rankingsScraper := background.BackgroundScraper{}
+ rankingsScraper := background_task.BackgroundTask{}
rankingsScraper.Start(func() {
rankings.GetRankings(database, 0, "", *blueAllianceConfigPtr)
})
- driverRankingParser := background.BackgroundScraper{}
+ driverRankingParser := background_task.BackgroundTask{}
driverRankingParser.Start(func() {
// Specify "" as the script path here so that the default is
// used.
diff --git a/scouting/webserver/rankings/BUILD b/scouting/webserver/rankings/BUILD
index 4696d26..5192e87 100644
--- a/scouting/webserver/rankings/BUILD
+++ b/scouting/webserver/rankings/BUILD
@@ -20,8 +20,8 @@
],
embed = [":rankings"],
deps = [
+ "//scouting/background_task",
"//scouting/db",
- "//scouting/scraping/background",
"//scouting/webserver/server",
],
)
diff --git a/scouting/webserver/rankings/rankings_test.go b/scouting/webserver/rankings/rankings_test.go
index 6f8af3b..03a4ac6 100644
--- a/scouting/webserver/rankings/rankings_test.go
+++ b/scouting/webserver/rankings/rankings_test.go
@@ -1,14 +1,15 @@
package rankings
import (
- "github.com/frc971/971-Robot-Code/scouting/db"
- "github.com/frc971/971-Robot-Code/scouting/scraping/background"
- "github.com/frc971/971-Robot-Code/scouting/webserver/server"
"net/http"
"reflect"
"strings"
"testing"
"time"
+
+ "github.com/frc971/971-Robot-Code/scouting/background_task"
+ "github.com/frc971/971-Robot-Code/scouting/db"
+ "github.com/frc971/971-Robot-Code/scouting/webserver/server"
)
type MockDatabase struct {
@@ -37,7 +38,7 @@
func TestGetRankings(t *testing.T) {
database := MockDatabase{}
- scraper := background.BackgroundScraper{}
+ scraper := background_task.BackgroundTask{}
tbaServer := server.NewScoutingServer()
tbaServer.Handle("/", ServeRankings(t, http.FileServer(http.Dir("../../"))))
tbaServer.Start(8000)