コード例 #1
0
ファイル: STOClient.cs プロジェクト: TzarIvan/ratel
            void process(Message message, Dictionary <int, bool> completed, int totalRuns)
            {
                var response = (STOResponse)message.@object();

                runner.received(response);
                var completedRun   = response.runNumber();
                var runTimeMillis  = response.runTimeMillis();
                var completionTime = response.completedAt();
                var isLocal        = response.instanceId().Equals("LOCAL");

                message.delete();
                // Letting message get GC'd, rather than sitting in the thread pool really helps with the Java heap space.
                queueWorkItem(() => {
                    lock (completed) {
                        if (completed.ContainsKey(completedRun))
                        {
                            return;
                        }
                        completed[completedRun] = true;
                        if (!isLocal)
                        {
                            completionTimes.Add(date(completionTime));
                            updateRunsPerMinute(runTimeMillis);
                        }
                    }
                    LogC.info("completed run " + completedRun + paren(completed.Count + "/" + totalRuns));
                    new Topic(CloudMonitor.progressTopic(systemId)).send(new Dictionary <string, object> {
                        { "RunsComplete", completed.Count },
                        { "TotalRuns", totalRuns },
                        { "RunsPerMinute", runsPerMinute },
                    });
                    writeResults(completedRun);
                });
            }
コード例 #2
0
        void populate()
        {
            var systemId = gui.systemId();

            clear();
            systemTopic = new Topic(CloudMonitor.topic(systemId));
            systemTopic.subscribe(fields => populate(systemId, fields));
            new Topic(CloudMonitor.progressTopic(systemId)).subscribe(fields => updateSummary(systemId, fields));
        }
コード例 #3
0
ファイル: TestCloudSTOTracker.cs プロジェクト: TzarIvan/ratel
        public void testSummary()
        {
            var gui      = startGui();
            var systemId = 1234;
            var topic    = new Topic(CloudMonitor.progressTopic(systemId));

            gui.setSystemId(systemId);
            gui.doAllWork();
            O.freezeNow("2008/02/03 02:00:00");
            topic.send(new Dictionary <string, object> {
                { "RunsComplete", 1000 },
                { "TotalRuns", 10000 },
                { "RunsPerMinute", 10 },
            });
            O.wait(() => gui.runsComplete() == 1000);
            AreEqual(date("2008/02/03 17:00:00"), gui.completionTime());
            AreEqual(10000, gui.totalRuns());
        }