using more than one external experiment server

34 views
Skip to first unread message

Coy Cooper Zheng

unread,
Sep 24, 2017, 4:06:02 PM9/24/17
to weblabdeusto
Hi, there:

This is Coy, and I am currently building a weblab through Weblab-Deusto software. First of all, thank you so much for sharing your sample and code with us, which greatly helps. 

Well, you know, to run servers in multiple host, you gave a template to set an external host in which the experiment server is. For concurrency, we can also easily add at most 10 experiments under one same laboratory by modifying the configuration file. However, all these experiments share the one same external experiment server. My question is that may I concurrently set more than one experiment servers for one same experiment?

For example, I have ten robots in my lab, and all the robots should be connected through Wi-Fi. Therefore, I want to set several external servers each of which will run the controller code for one special robot, because at any time, one laptop can connect to only one robot. For your template, I do be able to set multiple concurrent processes for one experiment, but in this case, all the users are going to control one same robot because all the commands from these users are sent to robot through one same experiment server. (one laptop connect to only one robot through wifi)

Could you please give me some hints or suggestion to fix up this problem? 

Make it clearer. My target is that when the student click the robot icon, the server will assign one(out of ten) open robot to him automatically. (at this time, some of robots may be occupied by other students.)

Thank you so much for your software, code and help, again.

Best Regards,
Coy 

Pablo Orduña

unread,
Sep 24, 2017, 11:56:39 PM9/24/17
to weblab...@googlegroups.com
Hi Coy,

Welcome to the community! I'm not sure if I followed you correctly. At one point, I think you're talking about something like this:



However, in the beginning you mention "one same external experiment server", which you might mean:



In both scenarios, there is one variable in the core server which is something like:

core_scheduling_systems = {
        'dummy_queue'       : ('PRIORITY_QUEUE', {}),
        'robots' : ('PRIORITY_QUEUE', {}),
}
This represents a queue, which might have a number of slots (10 in your case). Students will be balanced among those slots randomly by default. So as to manage the size of the queue, you play with this other variable:
core_coordinator_laboratory_servers = {
    'laboratory1:laboratory1@core_host' : {
            'exp1|dummy|Dummy experiments'       : 'dummy1@dummy_queue',
            'exp1|robot|Robotics experiments' : 'robot1@robots',
            'exp2|robot|Robotics experiments' : 'robot2@robots',
            'exp3|robot|Robotics experiments' : 'robot3@robots',
            'exp4|robot|Robotics experiments' : 'robot4@robots',
            'exp5|robot|Robotics experiments' : 'robot5@robots',
            'exp6|robot|Robotics experiments' : 'robot6@robots',
            'exp7|robot|Robotics experiments' : 'robot7@robots',
            'exp8|robot|Robotics experiments' : 'robot8@robots',
            'exp9|robot|Robotics experiments' : 'robot9@robots',
            'exp10|robot|Robotics experiments' : 'robot10@robots',
        },
}
Here, "exp1"-"exp10" is the instance (the same name that will be used in the laboratory server). "robot|Robotics experiments" is the name that is used in the database. So in the database you establish experiment "robot" of category "Robotics experiments", and here you define how many there are. Finally, on the right side, "robot1@robots" indicates the slots in the queue. So you are telling weblab "exp2" of "robot" of category "Robotics experiments" is the slot "robot2" of the queue "robots".

As it explains in the docs, you may repeat the slots if two experiments refer to the same equipment. For example, you may have a "robot-demo" and then you mean "robot2@robots", so no one can end in "exp2" of robot-demo and in "exp2" of "robot" at the same time. But in your case, you're clearly talking about 10 robots, so it should be as I mentioned.

Then, you have to configure it in the laboratory server. Here it depends on the two scenarios:

Scenario 1: 10 WiFi-controlled experiment servers

You have multiple experiment servers. Then (I only put 3, but you could put the rest):

laboratory_assigned_experiments = {
        'exp1:dummy@Dummy experiments' : {
                'coord_address' : 'experiment1:laboratory1@core_host',
                'checkers' : ()
            },
        'exp1:robot@Robotics experiments' : {
                'coord_address' : 'robot:robot@robot1_host',
                'checkers' : (),
                'api'      : '2',
            },
        'exp2:robot@Robotics experiments' : {
                'coord_address' : 'robot:robot@robot2_host',
                'checkers' : (),
                'api'      : '2',
            },
        'exp3:robot@Robotics experiments' : {
                'coord_address' : 'robot:robot@robot3_host',
                'checkers' : (),
                'api'      : '2',
            },
    }
Note that I'm assuming that in configuration.yml, you have 10 different hosts called robot1_host to robot10_host. Each will have a different IP address, because they are located in a different machine (each robot). You can see here a template.

Scenario 2: 1 experiment server acting as gateway for 10 WiFi-controlled robots

In some circumstances, you may want to have a single experiment server, and then 10 devices. For example, if the devices are resource constrained and can not run complex software. You can either run 10 times the same software on one server (using different ports), or you can have a single one which internally assigns the 10 sessions somehow (and this depends on you). For this, there is the "concurrent api". There is an example here. As you can see, the "DummyExperiment" only receives the regular arguments, while the "DummyConcurrentExperiment" receives those arguments plus a "session_id", which identifies the user. So if you have 3 students, you will have to keep track that one session_id is for one robot, another for another and so on. You typically do this assignments in the "do_start_experiment" and "do_dispose" methods. If you are using weblablib, or any HTTP unmanaged, then you must use 'experiments.http_experiment.ConcurrentHttpExperiment'. instead of 'experiments.http_experiment.HttpExperiment' in the configuration.yml

In this case, you still need exp1..exp10, but the coord_address will be the same for all. Note that the 'api' is "2_concurrent".
laboratory_assigned_experiments = {
        'exp1:dummy@Dummy experiments' : {
                'coord_address' : 'experiment1:laboratory1@core_host',
                'checkers' : ()
            },
        'exp1:robot@Robotics experiments' : {
                'coord_address' : 'robot:robot@core_host',
                'checkers' : (),
                'api'      : '2_concurrent',
            },
            'exp2:robot@Robotics experiments' : {
                'coord_address' : 'robot:robot@core_host',
                'checkers' : (),
                'api'      : '2_concurrent',
            },
            'exp3:robot@Robotics experiments' : {
                'coord_address' : 'robot:robot@core_host',
                'checkers' : (),
                'api'      : '2_concurrent',
            },
    }

Hope this helps. We are aware that the mechanism is too complex and should be done through the user interface. It's in our plans to do it in the next big release.

Best,

--
You received this message because you are subscribed to the Google Groups "weblabdeusto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weblabdeusto+unsubscribe@googlegroups.com.
To post to this group, send email to weblab...@googlegroups.com.
Visit this group at https://groups.google.com/group/weblabdeusto.
For more options, visit https://groups.google.com/d/optout.



--
Pablo

Coy Cooper Zheng

unread,
Sep 25, 2017, 11:34:35 PM9/25/17
to weblabdeusto
Hi, Mr. Pablo:

Thank you for your kind reply. Your solution is very clear and detailed for me. I will try this when I arrive the lab tomorrow. I though the "exp_host" in the template is a reserved variable for external server only and I cannot set other external servers. That's why I felt confused and didn't know how to add more experiment servers. Based on your reply, I connect the dots very clearly now. I can have "exp_host2", "exp_host3" and other as many external servers as I want. I will figure it out tomorrow. Thank you so much again.

Best,
Coy

在 2017年9月24日星期日 UTC-4下午11:56:39,Pablo Orduña写道:
To unsubscribe from this group and stop receiving emails from it, send an email to weblabdeusto...@googlegroups.com.

To post to this group, send email to weblab...@googlegroups.com.
Visit this group at https://groups.google.com/group/weblabdeusto.
For more options, visit https://groups.google.com/d/optout.



--
Pablo
Reply all
Reply to author
Forward
0 new messages