public static async Task <Timeline> GetTimeline(string summaryName, AzureExperimentManager expManager, AzureSummaryManager summaryManager, string connectionString) { IDomainResolver domainResolver = GetDomainResolver(); var vm = await Timeline.Initialize(connectionString, summaryName, expManager, summaryManager); return(vm); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { mnuOptProgress.IsChecked = recentValues.ShowProgress; mnuOptResolveTimeoutDupes.IsChecked = recentValues.ResolveTimeoutDupes; mnuOptResolveSameTimeDupes.IsChecked = recentValues.ResolveSameTimeDupes; mnuOptResolveSlowestDupes.IsChecked = recentValues.ResolveSlowestDupes; mnuOptResolveInErrorsDupes.IsChecked = recentValues.ResolveInErrorsDupes; } catch (Exception ex) { uiService.ShowError(ex, "Failed to restore recent values"); } try { domainResolver = MEFDomainResolver.Instance; } catch (Exception ex) { uiService.ShowError(ex, "Failed to find domains"); } if (domainResolver == null || domainResolver.Domains.Length == 0) { domainResolver = new DomainResolver(new[] { new Measurement.Z3Domain() }); uiService.ShowWarning("No domains found; only Z3 domain will be available."); } }
public static IDomainResolver GetDomainResolver() { if (domainResolver == null) { domainResolver = new MEFDomainResolver(System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "bin")); } return(domainResolver); }
/// <summary> /// Create a new AgentDomains object /// </summary> /// <param name="tenancy">set of domains to manage</param> public AgentDomains(IDomainResolver tenancy) { m_tenancy = tenancy; if (tenancy is StaticDomainResolver && !tenancy.Validate(tenancy.Domains.ToArray())) { throw new ArgumentException("Missing domains."); } }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// and defaulting to the standard trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors) : this(domainResolver, privateCerts, publicCerts, anchors, TrustModel.Default, SMIMECryptographer.Default) { }
private LocalExperimentManager(FileStorage storage, IDomainResolver domainResolver) { if (storage == null) { throw new ArgumentNullException("storage"); } this.storage = storage; this.reference = storage.GetReferenceExperiment(); runningExperiments = new ConcurrentDictionary <ExperimentID, ExperimentInstance>(); runner = new LocalExperimentRunner(storage.Location, domainResolver); lastId = storage.MaxExperimentId; asyncNormal = new AsyncLazy <double>(this.ComputeNormal); }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> /// <param name="trustModel"> /// An instance or subclass of <see cref="SMIMECryptographer"/> providing a custom trust model. /// </param> /// <param name="cryptographer"> /// An instance or subclass of <see cref="Health.Direct.Agent"/> providing a custom cryptography model. /// </param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors, TrustModel trustModel, ISmimeCryptographer cryptographer) : this(domainResolver, privateCerts, publicCerts, anchors, trustModel, cryptographer, CertPolicyResolvers.Default) { }
public LocalExperimentRunner(string rootFolder, IDomainResolver domainResolver) { if (rootFolder == null) { new ArgumentNullException("rootFolder"); } if (domainResolver == null) { new ArgumentNullException("domainResolver"); } scheduler = new LimitedConcurrencyLevelTaskScheduler(1); factory = new TaskFactory(scheduler); this.rootFolder = rootFolder; this.domainResolver = domainResolver; }
public static IDomainResolver GetDomainResolver() { if (domainResolver == null) { string p; try { p = System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "bin"); } catch (Exception) { p = System.AppDomain.CurrentDomain.BaseDirectory; } domainResolver = new MEFDomainResolver(p); } return(domainResolver); }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> /// <param name="trustModel"> /// An instance or subclass of <see cref="SMIMECryptographer"/> providing a custom trust model. /// </param> /// <param name="cryptographer"> /// An instance or subclass of <see cref="Health.Direct.Agent"/> providing a custom cryptography model. /// </param> /// <param name="certPolicyResolvers">Certificate <see cref="ICertPolicyResolvers">policy container</see></param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors, TrustModel trustModel, ISmimeCryptographer cryptographer, ICertPolicyResolvers certPolicyResolvers) { m_managedDomains = new AgentDomains(domainResolver); if (privateCerts == null) { throw new ArgumentNullException("privateCerts"); } if (publicCerts == null) { throw new ArgumentNullException("publicCerts"); } if (anchors == null) { throw new ArgumentNullException("anchors"); } if (trustModel == null) { throw new ArgumentNullException("trustModel"); } if (cryptographer == null) { throw new ArgumentNullException("cryptographer"); } m_privateCertResolver = privateCerts; m_publicCertResolver = publicCerts; m_cryptographer = cryptographer; m_trustAnchors = anchors; m_trustModel = trustModel; if (!m_trustModel.CertChainValidator.HasCertificateResolver) { m_trustModel.CertChainValidator.IssuerResolver = m_publicCertResolver; } m_minTrustRequirement = TrustEnforcementStatus.Success; m_privatePolicyResolver = certPolicyResolvers.PrivateResolver; m_publicPolicyResolver = certPolicyResolvers.PublicResolver; }
public AzureExperimentManagerViewModel(AzureExperimentManager manager, IUIService uiService, IDomainResolver domainResolver) { if (manager == null) { throw new ArgumentNullException("manager"); } this.manager = manager; if (uiService == null) { throw new ArgumentNullException("uiService"); } this.uiService = uiService; if (domainResolver == null) { throw new ArgumentNullException("domainResolver"); } this.domainResolver = domainResolver; }
/// <summary> /// Creates a agent from settings. /// </summary> /// <returns>The configured agent instance.</returns> public DirectAgent CreateAgent() { this.Validate(); ICertificateResolver privateCerts = this.PrivateCerts.CreateResolver(); ICertificateResolver publicCerts = this.PublicCerts.CreateResolver(); ITrustAnchorResolver trustAnchors = this.Anchors.Resolver.CreateResolver(); TrustModel trustModel = (this.Trust != null) ? this.Trust.CreateTrustModel() : TrustModel.Default; SMIMECryptographer cryptographer = this.Cryptographer.Create(); IDomainResolver domainResolver = this.CreateResolver(); DirectAgent agent = new DirectAgent(domainResolver, privateCerts, publicCerts, trustAnchors, trustModel, cryptographer); agent.AllowNonWrappedIncoming = m_allowNonWrappedIncoming; agent.WrapMessages = m_wrapOutgoing; return(agent); }
public static DirectAgent CreateAgent( IDomainResolver domain, string certsBasePath, ISmimeCryptographer cryptographer, ICertPolicyResolvers certPolicyResolvers) { MemoryX509Store privateCerts = LoadPrivateCerts(certsBasePath, false); MemoryX509Store publicCerts = LoadPublicCerts(certsBasePath); TrustAnchorResolver anchors = new TrustAnchorResolver( (IX509CertificateStore)LoadOutgoingAnchors(certsBasePath), (IX509CertificateStore)LoadIncomingAnchors(certsBasePath)); return(new DirectAgent( domain, privateCerts.CreateResolver(), publicCerts.CreateResolver(), anchors, TrustModel.Default, cryptographer ?? SMIMECryptographer.Default, certPolicyResolvers )); }
public AzureSummaryManager(string storageConnectionString, IDomainResolver domainResolver) { if (domainResolver == null) { throw new ArgumentNullException(nameof(domainResolver)); } var cs = new StorageAccountConnectionString(storageConnectionString).ToString(); storage = new AzureExperimentStorage(cs); storageAccount = CloudStorageAccount.Parse(cs); blobClient = storageAccount.CreateCloudBlobClient(); summaryContainer = blobClient.GetContainerReference(summaryContainerName); var cloudEntityCreationTasks = new Task[] { summaryContainer.CreateIfNotExistsAsync() }; resolveDomain = domainResolver; Task.WaitAll(cloudEntityCreationTasks); }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// and defaulting to the standard trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> /// <param name="certPolicyResolvers">Certificate <see cref="ICertPolicyResolvers">policy container</see></param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors , ICertPolicyResolvers certPolicyResolvers, IPolicyFilter polciyFilter) : this(domainResolver, privateCerts, publicCerts, anchors, TrustModel.Default, SMIMECryptographer.Default, certPolicyResolvers, polciyFilter) { }
public void Init(PluginDefinition pluginDef) { var settings = pluginDef.DeserializeSettings <CustomStaticDomainResolverSettings>(); m_innerResolver = settings.CreateResolver(); }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// and defaulting to the standard trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> /// <param name="certPolicyResolvers">Certificate <see cref="ICertPolicyResolvers">policy container</see></param> /// <param name="polciyFilter"></param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors , ICertPolicyResolvers certPolicyResolvers, IPolicyFilter polciyFilter) : this(domainResolver, privateCerts, publicCerts, anchors, TrustModel.Default, SMIMECryptographer.Default, certPolicyResolvers, polciyFilter) { }
public static LocalExperimentManager OpenExperiments(string experimentsFolder, IDomainResolver domainResolver) { FileStorage storage = FileStorage.Open(experimentsFolder); LocalExperimentManager manager = new LocalExperimentManager(storage, domainResolver); return(manager); }
public NewExperimentViewModel(AzureExperimentManagerViewModel manager, IUIService service, RecentValuesStorage recentValues, string creator, IDomainResolver domainResolver) { if (manager == null) { throw new ArgumentNullException(nameof(manager)); } if (service == null) { throw new ArgumentNullException(nameof(service)); } if (recentValues == null) { throw new ArgumentNullException(nameof(recentValues)); } if (domainResolver == null) { throw new ArgumentNullException(nameof(domainResolver)); } this.manager = manager; this.service = service; this.recentValues = recentValues; this.creator = creator; this.domainResolver = domainResolver; benchmarkContainerUri = ExperimentDefinition.DefaultContainerUri; benchmarkContainerUriNotDefault = ""; isDefaultBenchmarkContainerUri = true; ChooseDirectoryCommand = new DelegateCommand(ChooseDirectory); ChooseCategoriesCommand = new DelegateCommand(ChooseCategories); ChooseExecutableCommand = new DelegateCommand(ChooseExecutable); ChoosePoolCommand = new DelegateCommand(ListPools); benchmarkDirectory = recentValues.BenchmarkDirectory; categories = recentValues.BenchmarkCategories; timelimit = recentValues.BenchmarkTimeLimit.TotalSeconds; exptimelimit = recentValues.ExperimentTimeLimit.TotalSeconds; memlimit = recentValues.BenchmarkMemoryLimit; note = recentValues.ExperimentNote; allowAdaptiveRuns = recentValues.AllowAdaptiveRuns; maxRepetitions = recentValues.MaxRepetitions; maxTimeForAdaptiveRuns = recentValues.MaxTimeForAdaptiveRuns; Domain = Domains[0]; // Following will override the defaults given when setting the Domain above. string storedExt = recentValues.BenchmarkExtension; if (!string.IsNullOrEmpty(storedExt)) { extension = storedExt; } string storedParam = recentValues.ExperimentExecutableParameters; if (!string.IsNullOrEmpty(storedParam)) { parameters = storedParam; } UseMostRecentExecutable = true; RecentBlobDisplayName = "searching..."; taskRecentBlob = FindRecentExecutable(); selectedPool = recentValues.BatchPool; }
public void Init(PluginDefinition pluginDef) { var settings = pluginDef.DeserializeSettings<CustomStaticDomainResolverSettings>(); m_innerResolver = settings.CreateResolver(); }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> /// <param name="trustModel"> /// An instance or subclass of <see cref="SMIMECryptographer"/> providing a custom trust model. /// </param> /// <param name="cryptographer"> /// An instance or subclass of <see cref="Health.Direct.Agent"/> providing a custom cryptography model. /// </param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors, TrustModel trustModel, SMIMECryptographer cryptographer) : this(domainResolver, privateCerts, publicCerts, anchors, trustModel, cryptographer, CertPolicyResolvers.Default, null) { }
public static LocalExperimentManager NewExperiments(string experimentsFolder, ReferenceExperiment reference, IDomainResolver domainResolver) { ExperimentDefinition def = MakeRelativeDefinition(experimentsFolder, reference.Definition); ReferenceExperiment relRef = new ReferenceExperiment(def, reference.Repetitions, reference.ReferenceValue); FileStorage storage = FileStorage.Open(experimentsFolder); storage.Clear(); storage.SaveReferenceExperiment(relRef); LocalExperimentManager manager = new LocalExperimentManager(storage, domainResolver); return(manager); }
public static async Task <ExperimentPropertiesViewModel> CreateAsync(ExperimentManager manager, int id, IDomainResolver domainResolver, IUIService ui) { if (manager == null) { throw new ArgumentNullException("manager"); } Experiment exp = await manager.TryFindExperiment(id); if (exp == null) { throw new KeyNotFoundException(string.Format("There is no experiment with id {0}.", id)); } return(new ExperimentPropertiesViewModel(exp.Definition, exp.Status, domainResolver.GetDomain(exp.Definition.DomainName ?? "Z3"), manager, ui)); }
/// <summary> /// Creates a DirectAgent instance, specifying private, external and trust anchor certificate stores, and /// trust and cryptography models. /// </summary> /// <param name="domainResolver"> /// An <see cref="IDomainResolver"/> instance providing array of local domain name managed by this agent. /// </param> /// <param name="privateCerts"> /// An <see cref="ICertificateResolver"/> instance providing private certificates /// for senders of outgoing messages and receivers of incoming messages. /// </param> /// <param name="publicCerts"> /// An <see cref="ICertificateResolver"/> instance providing public certificates /// for receivers of outgoing messages and senders of incoming messages. /// </param> /// <param name="anchors"> /// An <see cref="ITrustAnchorResolver"/> instance providing trust anchors. /// </param> /// <param name="trustModel"> /// An instance or subclass of <see cref="SMIMECryptographer"/> providing a custom trust model. /// </param> /// <param name="cryptographer"> /// An instance or subclass of <see cref="Health.Direct.Agent"/> providing a custom cryptography model. /// </param> public DirectAgent(IDomainResolver domainResolver, ICertificateResolver privateCerts, ICertificateResolver publicCerts, ITrustAnchorResolver anchors, TrustModel trustModel, SMIMECryptographer cryptographer) { m_managedDomains = new AgentDomains(domainResolver); if (privateCerts == null) { throw new ArgumentNullException("privateCerts"); } if (publicCerts == null) { throw new ArgumentNullException("publicCerts"); } if (anchors == null) { throw new ArgumentNullException("anchors"); } if (trustModel == null) { throw new ArgumentNullException("trustModel"); } if (cryptographer == null) { throw new ArgumentNullException("cryptographer"); } m_privateCertResolver = privateCerts; m_publicCertResolver = publicCerts; m_cryptographer = cryptographer; m_trustAnchors = anchors; m_trustModel = trustModel; if (!m_trustModel.CertChainValidator.HasCertificateResolver) { m_trustModel.CertChainValidator.IssuerResolver = m_publicCertResolver; } m_minTrustRequirement = TrustEnforcementStatus.Success; }
public static async void SaveMetaCSV(string filename, ExperimentStatusViewModel[] experiments, ExperimentManager manager, IDomainResolver domainResolver, IUIService uiService) { if (filename == null) { throw new ArgumentNullException("filename"); } if (experiments == null) { throw new ArgumentNullException("experiments"); } if (manager == null) { throw new ArgumentNullException("manager"); } if (domainResolver == null) { throw new ArgumentNullException("domain"); } if (uiService == null) { throw new ArgumentNullException("uiService"); } var handle = uiService.StartIndicateLongOperation("Save meta csv..."); try { StreamWriter f = new StreamWriter(filename, false); f.WriteLine("\"ID\",\"# Total\",\"# SAT\",\"# UNSAT\",\"# UNKNOWN\",\"# Timeout\",\"# Memout\",\"# Bug\",\"# Error\",\"# Unique\",\"Parameters\",\"Note\""); var count = experiments.Length; var b = new ExperimentResults[count]; b = await DownloadResultsAsync(experiments, manager); var unique = computeUnique(experiments, b); for (var i = 0; i < count; i++) { var domain = domainResolver.GetDomain(experiments[i].Definition.DomainName ?? "Z3"); var aggr = domain.Aggregate(b[i].Benchmarks.Select(r => new ProcessRunResults(new ProcessRunAnalysis(r.Status, r.Properties), r.CPUTime.TotalSeconds))); var statistics = new ExperimentStatistics(aggr); var def = experiments[i].Definition; string ps = def.Parameters.Trim(' '); string note = experiments[i].Note.Trim(' '); int? sat = statistics == null ? null : (int?)int.Parse(statistics.AggregatedResults.Properties[Z3Domain.KeySat], CultureInfo.InvariantCulture); int? unsat = statistics == null ? null : (int?)int.Parse(statistics.AggregatedResults.Properties[Z3Domain.KeyUnsat], CultureInfo.InvariantCulture); int? unknown = statistics == null ? null : (int?)int.Parse(statistics.AggregatedResults.Properties[Z3Domain.KeyUnknown], CultureInfo.InvariantCulture); int? bugs = statistics == null ? null : (int?)statistics.AggregatedResults.Bugs; int? errors = statistics == null ? null : (int?)statistics.AggregatedResults.Errors; int? timeouts = statistics == null ? null : (int?)statistics.AggregatedResults.Timeouts; int? memouts = statistics == null ? null : (int?)statistics.AggregatedResults.MemoryOuts; f.WriteLine(experiments[i].ID + "," + experiments[i].BenchmarksTotal + "," + sat + "," + unsat + "," + unknown + "," + timeouts + "," + memouts + "," + bugs + "," + errors + "," + unique[i] + "," + "\"" + ps + "\"," + "\"" + note + "\""); } f.WriteLine(); f.Close(); } catch (Exception ex) { uiService.ShowError(ex, "Failed to save meta CSV"); } finally { uiService.StopIndicateLongOperation(handle); } }