Skip to content

Commit

Permalink
add an option to skip downloading the binary
Browse files Browse the repository at this point in the history
Signed-off-by: yeya24 <[email protected]>
  • Loading branch information
yeya24 committed Mar 6, 2020
1 parent c63600a commit 062c863
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
nmImporterIP = "importer-ip"
nmDB = "db"
binaryURL = "binary-url"
skipDownload = "skip-download"
)

var (
Expand All @@ -55,8 +56,9 @@ var (
dataDir = flag.String(nmDataDir, "", "data source directory of lightning")
importerIP = flag.String(nmImporterIP, "", "ip address of tikv-importer")

dbName = flag.String(nmDB, "tpcc", "test database name")
goTPCBinary = flag.String(binaryURL, "https://github.com/yeya24/go-tpc/releases/download/v0.1/go-tpc", "url of the go-tpc binary to download")
dbName = flag.String(nmDB, "tpcc", "test database name")
goTPCBinary = flag.String(binaryURL, "https://github.com/yeya24/go-tpc/releases/download/v0.1/go-tpc", "url of the go-tpc binary to download")
skipDownloading = flag.Bool(skipDownload, false, "skip downloading the go-tpc binary")
)

func main() {
Expand All @@ -74,7 +76,7 @@ func main() {

var start2 time.Time
if *all || *csv {
if err = fetchTpcc(dataDirs, lightningIPs); err != nil {
if err = fetchTpcc(dataDirs, lightningIPs, *skipDownloading); err != nil {
os.Exit(1)
}
start2 = time.Now()
Expand Down Expand Up @@ -160,7 +162,7 @@ func getLightningIPsAndDataDirs() (lightningIPs, dataDirs []string, err error) {
> echo fileLocation=%s >> /tmp/benchmarksql/run/props.mysql
> echo tableName=%s >> /tmp/benchmarksql/run/props.mysql
*/
func fetchTpcc(lightningDirs []string, lightningIPs []string) (err error) {
func fetchTpcc(lightningDirs []string, lightningIPs []string, skipDownloading bool) (err error) {
errCh := make(chan error, 3)
wg := &sync.WaitGroup{}
for i, lightningIP := range lightningIPs {
Expand All @@ -172,11 +174,13 @@ func fetchTpcc(lightningDirs []string, lightningIPs []string) (err error) {
errCh <- err
return
}
// TODO(yeya24): This is just a tmp release to download the binary.
// Change it when the binary can be directly download in the main repo.
if _, _, err = runCmd("ssh", ip, fmt.Sprintf("wget -O /tmp/go-tpc %s; chmod +x /tmp/go-tpc", *goTPCBinary)); err != nil {
errCh <- err
return
if skipDownloading {
// TODO(yeya24): This is just a tmp release to download the binary.
// Change it when the binary can be directly download in the main repo.
if _, _, err = runCmd("ssh", ip, fmt.Sprintf("wget -O /tmp/go-tpc %s; chmod +x /tmp/go-tpc", *goTPCBinary)); err != nil {
errCh <- err
return
}
}
fmt.Println("Download go-tpc binary successfully!")
if _, _, err = runCmd("ssh", ip, fmt.Sprintf("mkdir -p %s", lightningDirs[i])); err != nil {
Expand Down

0 comments on commit 062c863

Please sign in to comment.