Hi,
>From a client side, I'd like to be notified that jobs are achieved in a
distant lava server. I started with the example provided at
https://validation.linaro.org/static/docs/v2/data-export.html#write-your-ow…
1. In a 1st try I've changed the example - because I'm using port 10080 -
and it works without the <lookup_publisher> . For that, I've hard coded
the url returned by lookup_publisher but this only prints out one status at
a time, ie :I needed to restart the script each time to have updates :
"Submited"->*Ctrl-C*->Running->*Ctrl-C*->complete
2. In a 2nd time I've tried to implement lookup_publisher thinking the
status would be updated automatically. In that case it wants to connect
to 5500 and obviously fails after timeout
import xmlrpclib
>
> import argparse
> import yaml
> import signal
> import zmq
> import xmlrpclib
> from urlparse import urlsplit
>
>
> FINISHED_JOB_STATUS = ["Complete", "Incomplete", "Canceled"]
>
> token = "mytoken"
> username = "username"
> #hostname = "lava-server:10080"
>
>
> class JobEndTimeoutError(Exception):
> """ Raise when the specified job does not finish in certain timeframe.
> """
>
>
> class Timeout(object):
> """ Timeout error class with ALARM signal. Accepts time in seconds. """
> class TimeoutError(Exception):
> pass
>
> def __init__(self, sec):
> self.sec = sec
>
> def __enter__(self):
> signal.signal(signal.SIGALRM, self.timeout_raise)
> signal.alarm(self.sec)
>
> def __exit__(self, *args):
> signal.alarm(0)
>
> def timeout_raise(self, *args):
> raise Timeout.TimeoutError()
>
>
> class JobListener(object):
>
> def __init__(self, url):
> self.context = zmq.Context.instance()
> self.sock = self.context.socket(zmq.SUB)
>
> self.sock.setsockopt(zmq.SUBSCRIBE, b"")
> self.sock.connect(url)
>
> def wait_for_job_end(self, job_id, timeout=None):
>
> try:
> with Timeout(timeout):
> while True:
> msg = self.sock.recv_multipart()
> try:
> (topic, uuid, dt, username, data) = msg[:]
> except IndexError:
> # Droping invalid message
> continue
>
> data = yaml.safe_load(data)
> if "job" in data:
> if data["job"] == job_id:
> if data["status"] in FINISHED_JOB_STATUS:
> return data
>
> except Timeout.TimeoutError:
> raise JobEndTimeoutError(
> "JobListener timed out after %s seconds." % timeout)
>
> def lookup_publisher(hostname):
> """
> Lookup the publisher details using XML-RPC
> on the specified hostname.
> """
> xmlrpc_url = "http://%s:10080/RPC2" % (hostname)
> server = xmlrpclib.ServerProxy(xmlrpc_url)
> socket = server.scheduler.get_publisher_event_socket()
> port = urlsplit(socket).port
> listener_url = 'tcp://%s:%s' % (hostname,port)
> print("Using %s" % listener_url)
> return listener_url
>
>
>
> if __name__ == '__main__':
> # timeout=1200
>
> parser = argparse.ArgumentParser()
> parser.add_argument("-j", "--job-id", type=int, help="Job ID to wait
> for")
> parser.add_argument("-t", "--timeout", type=int, help="Timeout in
> seconds")
> parser.add_argument("--hostname", help="hostname of the instance")
>
> options = parser.parse_args()
>
> # server = xmlrpclib.ServerProxy("http://%s:%s@%s/RPC2" % (username,
> token, hostname))
>
> #print(server.system.listMethods())
> # ret_status=server.scheduler.job_status(options.job_id)
> # print (ret_status['job_status'])
>
> #publisher = 'tcp://%s' % (hostname)
> publisher = lookup_publisher(options.hostname)
>
> listener = JobListener(publisher)
> listener.wait_for_job_end(options.job_id, options.timeout)
>
>
Hi all ,
I have saw the doc about : https://validation.linaro.org/static/docs/v2/test-repositories.html#test-re…!
My test-definition is in the brach dev-br1, not the master . So I point the branch in my yaml file, but it do noting ! Why?
Please give me some help?
Best Regards
XuHongyu
This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.
Hello
I have installed a fresh 2017.12 in a docker and I hit two problem:
- With the exception of lava-coordinator, all services (lava-master, lava-server, lava-slave, etc...) fail to start with:
service lava-xxxx start
lava-xxxx: unrecognized service
All Other service successfully start (postgresql, apache2)
- I have then re-added old init scripts and when I add a worker with:
"lava-server manage workers add lab-slave"
I get:
Traceback (most recent call last):
File "/usr/bin/lava-server", line 78, in <module>
main()
File "/usr/bin/lava-server", line 74, in main
execute_from_command_line(django_options)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/dist-packages/lava_server/management/commands/workers.py", line 77, in handle
options["disabled"])
KeyError: 'disabled'
iNote that before I have successfully done commands like adding user or device-types
Regards