forked from vieter-v/vieter
feat(build): start of server-side job queue
This commit is contained in:
parent
6281ef7607
commit
9a49d96e20
9 changed files with 174 additions and 28 deletions
|
|
@ -20,6 +20,6 @@ pub fn agent(conf Config) ! {
|
|||
logger.set_full_logpath(log_file)
|
||||
logger.log_to_console_too()
|
||||
|
||||
mut d := agent.agent_init(logger, conf)
|
||||
mut d := agent_init(logger, conf)
|
||||
d.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@ import conf as vconf
|
|||
|
||||
struct Config {
|
||||
pub:
|
||||
log_level string = 'WARN'
|
||||
api_key string
|
||||
address string
|
||||
data_dir string
|
||||
max_concurrent_builds int = 1
|
||||
polling_frequency int = 30
|
||||
log_level string = 'WARN'
|
||||
api_key string
|
||||
address string
|
||||
data_dir string
|
||||
max_concurrent_builds int = 1
|
||||
polling_frequency int = 30
|
||||
// Architecture of agent
|
||||
/* arch string */
|
||||
/* image_rebuild_frequency int = 1440 */
|
||||
// arch string
|
||||
// image_rebuild_frequency int = 1440
|
||||
}
|
||||
|
||||
// cmd returns the cli module that handles the cron daemon.
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ const (
|
|||
|
||||
struct AgentDaemon {
|
||||
logger shared log.Log
|
||||
conf Config
|
||||
conf Config
|
||||
// Which builds are currently running; length is same as
|
||||
// conf.max_concurrent_builds
|
||||
builds []BuildConfig
|
||||
// Atomic variables used to detect when a build has finished; length is the
|
||||
// same as conf.max_concurrent_builds
|
||||
client client.Client
|
||||
client client.Client
|
||||
atomics []u64
|
||||
}
|
||||
|
||||
|
|
@ -39,10 +39,8 @@ pub fn (mut d AgentDaemon) run() {
|
|||
for {
|
||||
free_builds := d.update_atomics()
|
||||
|
||||
if free_builds > 0 {
|
||||
|
||||
}
|
||||
|
||||
if free_builds > 0 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue