-
Notifications
You must be signed in to change notification settings - Fork 16
add siad
upgrading functionality
#62
base: master
Are you sure you want to change the base?
Conversation
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 |
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.
aren't APIAddr
and RPCAddr
redundant if you have an AntConfig
?
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.
yes, will clean this up
ant/ant.go
Outdated
continue | ||
} | ||
|
||
a.siad = siad |
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.
doesn't this require some sort of lock?
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.
yeah
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.
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. |
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.
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 | ||
} |
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.
the sleep needs to happen at the top of the loop, not the bottom
case "miner": | ||
go j.blockMining() | ||
case "host": | ||
go j.jobHost() |
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.
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.)
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.
what problems was this causing?
This PR adds to the antfarm the ability to specify an
UpgradePath
andUpgradeDelay
in the antfarm's config. AnUpgradePath
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.