Esempio n. 1
0
        public Benchmark(Contest contest, string linkToContest, string benchmarksDirectory)
        {
            //determine the full benchmark file path... although file might not have been downloaded yet
            string benchmarkPath = System.IO.Path.Combine(benchmarksDirectory, contest.PackageFileName);

            BenchmarkInfo = new BenchmarkInfo(contest.ContestGUID, contest.Name, 
                                                contest.Author, contest.Contributors, 
                                                contest.Description, contest.ShortDescription,
                                                benchmarkPath, contest.Deadline, linkToContest);
            ComponentTemplate = null;
            IsOnlineContest = true;
        }
        /// <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);
        }