Closed
Bug 522134
Opened 17 years ago
Closed 15 years ago
Create heartbeat for SUT test driver
Categories
(Testing :: General, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: cmtalbert, Unassigned)
References
Details
The SUT (native code) needs to have a heartbeat notification that communicates to the test agent.
Things communicated in the heartbeat:
JSON String containing:
* ID: 'unique ID of device'
* STATUS: 'running'|'idle'
Some optional parameters we may want to consider:
* JOBTime: '20000032' // some measure of time denoting how long the job has been running.
The heartbeat should be sent without prompting every so many seconds to the test agent. Probably once a minute is often enough, given how slow the devices are.
Comment 1•17 years ago
|
||
I'm a little concerned that we are pushing too much "smarts" down into the SUT driver. As far as the heartbeat is concerned, all it should do is check in with it's test agent (passing it's unique id) letting the test agent know that it is still alive. It shouldn't/doesn't know what it is doing besides starting or killing a program, copying a file, listing out the running processes or ...
Besides that, the test agent is where the context lives. The SUT driver's job is to know how to do something in a platform specific way. Let's try to keep the understanding of what the test run status is at the test agent layer.
Comment 2•17 years ago
|
||
the only question that I have from the bug and comment #1 is how will the SUT register with the TestServer originally? My understanding is that it would send a 'simple' heartbeat to the main server. Once the server knows about the device, it would then farm out a TestAgent to actually be a proxy for the heartbeat. The TestAgent can get any device info and status and send it up to the TestServer.
That is my understanding of this. I would assume we can just send a single packet up to the server and that would be enough for the heartbeat.
Comment 3•17 years ago
|
||
Again, I think we are starting to confuse the TestServer with the TestAgent.
The TestAgent registers and sends heartbeats to the TestBot via simple HTTP messages. That code is actually already written and you don't need to worry about it, you'll just subclass testbot.client.TestClient and when you start it it'll handle registering and doing the heartbeat. Your TestAgent instance will have an attribute called "client_info" which is a dict, anything changed on the dict will be pushed in the next heartbeat. The code to keep the heartbeat going on the TestAgent and communicate with the server is already written and has a passing unittest.
The part you need to worry about, and what is probably more complicated, is the heartbeat between the device and the TestAgent. Once you figure that out, all you need to do is set the status of the device as a new or existing key on client_info, we can figure out the specifics of that later and standardize it but what is important in the short term is to figure out the device to TestAgent stuff because it's still somewhat unknown how you would go about implementing it.
Comment 4•17 years ago
|
||
I am all on board for have the device/SUT talk only to a TestAgent and not the TestServer. My only concern then is how does the TestAgent know what devices are available? When we setup the device we will hard code it with an ip address to send the heartbeat to.
Other that that, what Mikeal says in Comment #3 makes a lot of sense.
Comment 5•17 years ago
|
||
We should not hard code the ip address for the SUT Agent. It needs to be configurable on the fly. Also I would not use IP addresses but rather hostnames so that we can change servers with little fuss. The way I see this working is.
1) the device starts up and sends a heartbeat to the registration server and then opens a "server socket" waiting to be contacted by the TestAgent.
2) the registration server starts up a TestAgent to handle the device.
3) the TestAgent contacts the device, queries the relevant info from the device and checks as to whether or not the device has an entry in the device table.
4) the TestAgent then does the "right thing" either updating or creating the entry in the device table.
5) the TestAgent then gets the job info from the server to run on the device and the fun starts.
6) at regular periods (tbd) the SUT driver sends the heartbeat to the TestAgent so that it knows that the SUT driver is still alive and well.
Comment 6•17 years ago
|
||
so I think we need to have a stable server that can accept startup heartbeats from the pool of devices. How is the name resolution going to work on the device? I am not sure if that is as easy as a desktop.
As for the post initialization, will we assume the testagent will always be available? If there are timeout issues sending the heartbeat will it fall back to the registration server?
Comment 7•17 years ago
|
||
name resolution is fine on the device. if it fails, we have a problem and the heartbeat should legitimately not show up.
Comment 8•17 years ago
|
||
As far as hostname to ip address translation is concerned we should be able to
call something like getaddrinfo(...) (winsock call) to handle this. Since we
are testing a browser it is not unreasonable to assume that the equivalent
functionality exists on the platform. Otherwise the browser would have to
require ip addrs rather than names. Your second point, post initialization is
an interesting one. We probably need some sort of error recovery scheme if the
device is unable to talk to the testagent. We could have it "fall back" to
server. What do you think?
This was a midair collision - I agree with blassey's comment.
Comment 9•17 years ago
|
||
The TestAgent implementation right now is a Python class. I think the scope of instances of that class needs to be to communicate with a single device. So communicating with multiple devices is just a matter of creating multiple instances.
It would make sense to have the device address be something passed to __init__ since it's scoped to an instance and not global for all instances of the class.
Comment 10•17 years ago
|
||
Also, if TestAgent becomes a subclass of my Client class and implements the do_job method then there will already be code that handles keeping all that code in a thread so the TestAgent code wouldn't have worry about not blocking or handling it's own threading.
| Reporter | ||
Comment 11•17 years ago
|
||
I think rolling this back to the main question of how does the code running on the device aka the DeviceAgent get started with an IP Address is useful. I think we drifted a bit out of scope.
So, on the device, when the device agent .exe is installed, I recommend that we include a simple text file that contains an IP address or a hostname to the server. The first thing the Device Agent does on startup is read the contents of that text file and ping the server to let it know it is alive. The server will then take care of inserting the Device's record into the database so that an agent can be informed about its existence.
Comment 12•17 years ago
|
||
what should the format of that ping be?
| Reporter | ||
Comment 13•17 years ago
|
||
comma delimited text. Or something equally simple. Right now, the only thing we need (I believe) is:
<deviceUID>,<IP>
And we may not even need IP, I just like to have it on there because I'm paranoid :)
Comment 14•15 years ago
|
||
I think the hearbeat is done, no?
(Found while doing a search for 'sut'.)
| Reporter | ||
Comment 15•15 years ago
|
||
Holy crap, this was done a long,long time ago in a galaxy far far away.
->WFM
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
| Assignee | ||
Updated•8 years ago
|
Component: New Frameworks → General
You need to log in
before you can comment on or make changes to this bug.
Description
•