Exemple #1
0
        /// <summary>
        /// Executes the publish contest.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="username">The username.</param>
        /// <param name="callback">The callback.</param>
        /// <exception cref="System.UriFormatException">throws when webservice url is malformed</exception>
        /// <exception cref="System.ArgumentNullException">throws when webservice url is null</exception>
        public void ExecutePublishContest(string ticket, string username, Callback <ContestPublishedResponse> callback)
        {
            //first execute creation of benchmark file! (it saves the file locally too)
            Define();

            //extract metrics definitions out of selected Experiment Results
            List <MetricDefinition> metrics;
            List <string>           datasets;

            BenchmarkResultsHelper.ExtractDatasetsAndMetricsDefinitions(SelectedExperimentResults, out metrics, out datasets);

            //define method creates the benchmark file
            Contest newContest = new Contest(BenchmarkInfo.Id,
                                             BenchmarkInfo.Name,
                                             BenchmarkInfo.Author,
                                             BenchmarkInfo.Contributors,
                                             BenchmarkInfo.ShortDescription,
                                             BenchmarkInfo.Description,
                                             BenchmarkInfo.Deadline,
                                             metrics,
                                             datasets,
                                             BenchmarkInfo.FilePath);

            //prepare baseline out of selected Experiment Results if publish baseline is checked
            if (PublishBaseline == true)
            {
                newContest.BaselineResults = BenchmarkResultsHelper.PrepareBaselineContestRestults(newContest.ContestGUID,
                                                                                                   SelectedExperimentResults, "Baseline", BaselineTechniqueDescription);
            }
            WebService.PublishContest(ticket, username, newContest, callback);
        }
Exemple #2
0
        public void ExecutePublishResults(string ticket, string username, Callback <ContestResultsPublishedResponse> publishingResultsCallback)
        {
            //get the unitname to be loaded from workspace
            string experimentResultsUnitname = SelectedBenchmark.BenchmarkInfo.ExperimentResultsUnitname;

            //create an experiment workspace wrapper with experiment info
            var benchmarkWorkspaceWrapper = new ExperimentWorkspaceWrapper(m_workspace, SelectedBenchmark.BenchmarkInfo.Id);

            var experimentResults = benchmarkWorkspaceWrapper.Load(experimentResultsUnitname) as TraceLabSDK.Types.Contests.TLExperimentResults;

            if (experimentResults != null)
            {
                ContestResults results = BenchmarkResultsHelper.PrepareBaselineContestRestults(SelectedBenchmark.BenchmarkInfo.Id,
                                                                                               experimentResults,
                                                                                               TechniqueName, TechniqueDescription);

                WebService.PublishContestResults(ticket, username, results, publishingResultsCallback);
            }
            else
            {
                throw new InvalidOperationException("The experiment results outputed in the contest are empty! Empty results cannot be publish! ");
            }
        }