public void testRestartMenuPopulation() { O.freezeNow("2008/08/08 11:00:00"); startGui(); IsEmpty(gui.launchers); LiveLauncher.publishHeartbeatFrom("jeffsmachine"); awaitLaunchers("[jeffsmachine]"); LiveLauncher.publishHeartbeatFrom("ericsmachine"); awaitLaunchers("[ericsmachine, jeffsmachine]"); LiveLauncher.publishHeartbeatFrom("jeffsmachine"); LiveLauncher.publishHeartbeatFrom("ericsmachine"); awaitLaunchers("[ericsmachine, jeffsmachine]"); }
void restart(string hostname, string system) { if (BloombergTagsTable.TAGS.anyAutoExecute(system) && !FerretControl.status().Equals("Stage")) { var answer = gui.askUser("This will put Ferret into Stage mode. Are you sure you want to do this?"); if (answer != YesNoCancel.YES) { return; } FerretControl.requestFerretChange("Stage"); wait(() => FerretControl.status().Equals("Stage")); } var fields = new Fields(); fields.put("System", system); fields.put("Hostname", hostname); fields.put("Timestamp", ymdHuman(now())); LiveLauncher.restartTopic().send(fields); }
public List <QNode> nodes() { var bySystem = new LazyDictionary <string, List <LiveSystem> > (system => new List <LiveSystem>()); each(systems, liveSystem => bySystem.get(liveSystem.siv().system()).Add(liveSystem)); var result = list(convert(bySystem.keys(), system => { var liveSystems = bySystem.get(system); var systemNode = new QNode(system, liveSystems.Count, 0); each(liveSystems, liveSystem => { var liveSystemNode = systemNode.add(new LiveSystemNode(liveSystem, 1, 0)); var liveMarkets = list <MsivPv>(liveSystem.liveMarkets()); each(liveMarkets, liveMarket => { try { var symbol = new Symbol(liveMarket.market()); var liveMarketNode = new LiveMarketNode(symbol, 1, 0); liveSystemNode.add(liveMarketNode); var topic = new Topic(liveSystem.topicName(OrderTable.prefix, symbol.name + "." + SystemHeartbeat.SUFFIX)); topic.subscribeIfNeeded(); updateModelNodes += () => updateNode(topic, liveMarket, liveMarketNode); symbol.subscribe(bar => recordMarketDataTickReceived(liveMarket, bar.time)); topic.subscribe(fields => { var tickTime = fields.time("lastTickProcessed"); ticks.get(liveMarket).systemProcessed(date(tickTime)); }); } catch (Exception ex) { LogC.err("exception caught subscribing to tick data for " + liveMarket + ", " + system, ex); gui.alertUser("exception caught susbcribing to data for " + liveMarket + ", " + system + ".\nSkipping... see log for details."); } }); updateModelNodes += () => updateNode(liveSystem, liveSystemNode); }); updateModelNodes += () => updateNode(systemNode); return(systemNode); })); timerManager().everyMillis(1000, updateModelNodes, out timer); LiveLauncher.subscribeHeartbeat(gui.launcherAvailable); LogC.ignore(timer); return(result); }
public void testCanPublishRestart() { LogC.useJavaLog = true; FerretControl.onOutgoing(fields => O.queueWorkItem(() => FerretControl.setStatus(fields.text("FERRETSTATE")))); system.populateDetailsIfNeeded(false); system.populateTagIfNeeded("QF.Example", false); FerretControl.setStatus("Ticket"); var tracker = startGui(); var restartRequests = LiveLauncher.restartTopic(); Fields received = null; restartRequests.subscribe(fields => { received = fields; }); tracker.restart(O.hostname(), system.id()); O.wait(() => received != null); AreEqual(system.id(), (int)received.longg("SystemId")); AreEqual(O.hostname(), received.text("Hostname")); gui.noMessage(); system.setAutoExecuteTrades(true); gui.stageAnswer(YesNoCancel.NO); restartRequests.setReadonly(true); tracker.restart(O.hostname(), system.id()); gui.hasMessage("This will put Ferret into Stage mode. Are you sure you want to do this?"); gui.stageAnswer(YesNoCancel.YES); restartRequests.setReadonly(false); received = null; tracker.restart(O.hostname(), system.id()); gui.hasMessage("This will put Ferret into Stage mode. Are you sure you want to do this?"); waitMatches("Stage", FerretControl.status); O.wait(() => received != null); received = null; tracker.restart(O.hostname(), system.id()); gui.noMessage(); O.wait(() => received != null); }
static void kill(string system) { LiveLauncher.killTopic().send("System", system + ""); }
public static void kill(int id) { LiveLauncher.killTopic().send("SystemId", id + ""); }
void subscribeLauncherHeartbeat() { LiveLauncher.subscribeHeartbeat((host, staleAt) => gui.launcherAvailable(host, staleAt)); }