[Haizea] Running multi-configuration in one program
Mehdi Sheikhalishahi
mehdi.alishahi at gmail.com
Sat Jun 12 17:50:27 CDT 2010
Being a singleton class for Manager was the reason behind this. By adding
another method to set new config the problem was solved.
On Sat, Jun 12, 2010 at 9:57 AM, Mehdi Sheikhalishahi <
mehdi.alishahi at gmail.com> wrote:
> Hi,
>
> I used multi-conf to create multiple configuration files. It is working
> fine, after that I have used some codes from multi-conf to find names of
> configurations and run them, there are lots of runs but for one
> configuration, while the config names are different.
> Here are my codes:
>
> def start():
> multiconfigfile =
> "/home/mehdi/workspace/IaaSScheduler/tests/config_ee_tests.conf"
> multiconfig = HaizeaMultiConfig.from_file(multiconfigfile)
>
> configs = multiconfig.get_configs()
> import os
> etcdir =
> os.path.abspath("/home/mehdi/workspace/IaaSScheduler/tests/multi_conf")
>
> from haizea.common.utils import generate_config_name
>
> for c in configs:
> profile = c.get_attr("profile")
> tracefile = c.get("tracefile")
> injfile = c.get("injectionfile")
> datafile = c.get("datafile")
> annotationfile = c.get("annotationfile")
> configname = generate_config_name(profile, tracefile,
> annotationfile, injfile)
> configfile = etcdir + "/%s.conf" % configname
> CONFIGFILE = configfile
> print "CONFIGFILE", CONFIGFILE
> #CONFIGFILE =
> "/home/mehdi/workspace/IaaSScheduler/tests/base_config_simulator.conf"
> #if (not self.opt.onlymissing or not os.path.exists(datafile)) and
> not configfile in exclude:
> # templatedata.append((configname, configfile))
>
> try:
> CONFIG = 0
> CONFIG = HaizeaConfig.from_file(CONFIGFILE)
> manager(CONFIG)
> del CONFIG
> except ConfigException, msg:
> print >> sys.stderr, "Error in configuration file:"
> print >> sys.stderr, msg
> #exit(1)
>
> def manager(CONFIG):
> from haizea.core.manager import Manager
> MANAGER = Manager(CONFIG)
> MANAGER.start()
> MANAGER.stop()
> del MANAGER
>
> start()
>
> --
> Regards,
> Mehdi
>
--
Regards,
Mehdi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.uchicago.edu/pipermail/haizea/attachments/20100613/57aa2e6c/attachment.htm
More information about the Haizea
mailing list