summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2018-01-09 11:35:29 +0200
committerIlias Apalodimas <ilias.apalodimas@linaro.org>2018-01-09 11:35:29 +0200
commite0658ef029ab8c9edc8c31f85d92d2c48883f648 (patch)
treeb53d520f3fe43ff7da4341291ebe0a684759e814
parent58cb599fa07dd9377200aa5a30362710836f8428 (diff)
downloadlava-sessions-e0658ef029ab8c9edc8c31f85d92d2c48883f648.tar.gz
added python3 script to start jobs
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
-rw-r--r--.gitignore1
-rw-r--r--.gitingore0
-rw-r--r--execs/ubuntu-build-essential.yaml1
-rwxr-xr-xpost.py51
4 files changed, 53 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fee9217
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.conf
diff --git a/.gitingore b/.gitingore
deleted file mode 100644
index e69de29..0000000
--- a/.gitingore
+++ /dev/null
diff --git a/execs/ubuntu-build-essential.yaml b/execs/ubuntu-build-essential.yaml
index b7f3a9b..a30acf7 100644
--- a/execs/ubuntu-build-essential.yaml
+++ b/execs/ubuntu-build-essential.yaml
@@ -38,3 +38,4 @@ install:
- sudo
- bison
- flex
+ - libpcap-dev
diff --git a/post.py b/post.py
new file mode 100755
index 0000000..5fbfc9a
--- /dev/null
+++ b/post.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+import sys
+import yaml
+#import xmlrpclib
+import xmlrpc.client
+import configparser
+
+configfile = "post.conf"
+
+def get_cfg_value(configfile, category, what, strict = 'yes'):
+ ret = None
+ parser = configparser.SafeConfigParser()
+
+ parser.read(configfile)
+ try:
+ ret = parser.get(category, what)
+ except:
+ print('No option %s= found in config file. Fix your config file' % what)
+ if strict == 'yes':
+ exit(1);
+
+ return ret
+
+def submit_yaml_job(job_yaml_str, user, token, host):
+ server = xmlrpc.client.ServerProxy("https://%s:%s@%s/RPC2" % (user, token,
+ host))
+ try:
+ job_id = server.scheduler.submit_job(job_yaml_str)
+ #print "Job submitted successfuly"
+ except:
+ raise
+
+
+def main():
+ if len(sys.argv) < 1:
+ print ("""usage: submit_job.py JOB_YAML""")
+ exit(1)
+
+ with open(sys.argv[1], 'r') as stream:
+ job_yaml = stream.read()
+
+ user = get_cfg_value(configfile, 'auth', 'user')
+ token = get_cfg_value(configfile, 'auth', 'token')
+ host = get_cfg_value(configfile, 'auth', 'host')
+ for count in range(0, 2):
+ submit_yaml_job(job_yaml, user, token, host)
+
+
+if __name__ == "__main__":
+ main()