Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

add siad upgrading functionality #62

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

add siad upgrading functionality #62

wants to merge 10 commits into from

Conversation

avahowell
Copy link
Contributor

This PR adds to the antfarm the ability to specify an UpgradePath and UpgradeDelay in the antfarm's config. An UpgradePath is a slice of strings of sia versions (1.1.0, 1.1.1, 1.1.2, etc) to test. If specified, the ant will stop the running siad process and replace it with the specified version, after the specified delay, keeping the same data. This will allow us to more throughly test upgrades from older versions.

ant/ant.go Outdated
}

// An Ant is a Sia Client programmed with network user stories. It executes
// these user stories and reports on their successfulness.
type Ant struct {
APIAddr string
RPCAddr string
config AntConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't APIAddr and RPCAddr redundant if you have an AntConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will clean this up

ant/ant.go Outdated
continue
}

a.siad = siad
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this require some sort of lock?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, no it actually doesn't since the only place where a.siad is read is in Ant's Close() method, which stops the Ant's threadgroup, ending this thread before a.siad is read by Close's thread

@@ -84,10 +84,14 @@ of eachother.
'SiadPath': the path to the `siad` binary, by default the `siad` in your path will be used.
'Jobs': an array of jobs for this ant to run. available jobs include: ['miner', 'host', 'renter', 'gateway']
'DesiredCurrency': a minimum (integer) amount of SiaCoin that this Ant will attempt to maintain by mining currency. This is mutually exclusive with the `miner` job.
'UpgradePath': an array of version strings to upgrade to. Each upgrade will be triggered after `UpgradeDelay` seconds.
'UpgradeDir': path to a directory containing the binaries to use for upgrades. This directory should be in the format of 'dir/version-platform-arch/siad'.
'UpgradeDelay': number of seconds to wait between upgrades.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these maybe be part of a job, rather than part of the config?

case <-time.After(time.Second * time.Duration(a.Config.UpgradeDelay)):
case <-a.tg.StopChan():
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sleep needs to happen at the top of the loop, not the bottom

case "miner":
go j.blockMining()
case "host":
go j.jobHost()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to cause problems. I don't think the host job needs to be explicitly restarted. (Well, it probably should be, but it needs to detect that it was restarted.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what problems was this causing?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants