diff options
author | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-03-30 12:32:58 +0100 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-04-17 08:41:58 +0000 |
commit | ab92ce0343b838b336313f604ea035a60dfcb960 (patch) | |
tree | 945fd98350ba347ca8c2e326670cdfe5f039b765 /morphlib/plugins | |
parent | 1c125ade7e19d1f92b49ad010ff4a9ec3faa36e4 (diff) | |
download | morph-ab92ce0343b838b336313f604ea035a60dfcb960.tar.gz |
distbuild: Add distbuild-list-jobs function
Add InitiatorListJobs class and list-jobs message template, add
distbuild-list-jobs to morph commandlist, send running job
information back to initiator, split out handling of build request
and list-jobs messages to separate functions and change generating
a random integer to UUID for message identification
Change-Id: Id02604f2c1201dbc10f6bbd7f501b8ce1ce0deae
Diffstat (limited to 'morphlib/plugins')
-rw-r--r-- | morphlib/plugins/distbuild_plugin.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/morphlib/plugins/distbuild_plugin.py b/morphlib/plugins/distbuild_plugin.py index ac3957f3..8aaead10 100644 --- a/morphlib/plugins/distbuild_plugin.py +++ b/morphlib/plugins/distbuild_plugin.py @@ -40,6 +40,48 @@ class DistbuildOptionsPlugin(cliapp.Plugin): pass +class DistbuildListJobsPlugin(cliapp.Plugin): + + RECONNECT_INTERVAL = 30 # seconds + MAX_RETRIES = 1 + + def enable(self): + self.app.add_subcommand('distbuild-list-jobs', + self.distbuild_list_jobs, arg_synopsis='') + + def disable(self): + pass + + def distbuild_list_jobs(self, args): + '''Display a list of currently running distbuilds. + + Lists all distbuilds running on a given address and port, as set in + the client machine's morph.conf file + + Example output: + + '1 distbuild build request(s) currently in progress + Initiator connection (address:port): localhost:7878 + Build request message: {'repo': 'baserock:baserock/definitions', + 'original_ref': 'BRANCH_NAME', 'ref': 'SHA1', 'morphology': + 'systems/devel-system-x86_64-generic.morph', 'protocol_version': 1, + 'type': 'build-request', 'id': 'InitiatorConnection-x'}' + Build request ID: InitiatorConnection-x + + ''' + + addr = self.app.settings['controller-initiator-address'] + port = self.app.settings['controller-initiator-port'] + icm = distbuild.InitiatorConnectionMachine(self.app, addr, port, + distbuild.InitiatorListJobs, + [self.app], + self.RECONNECT_INTERVAL, + self.MAX_RETRIES) + loop = distbuild.MainLoop() + loop.add_state_machine(icm) + loop.run() + + class SerialiseArtifactPlugin(cliapp.Plugin): def enable(self): |