/* Copyright (c) Microsoft Corporation All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. */ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using System.Reflection; using System.Linq; namespace Microsoft.Research.DryadLinq { /// /// This class consists of static properties and fields that control the /// details of the DryadLinq configuration. /// internal class StaticConfig { internal const string DryadHomeVar = "DRYAD_HOME"; internal static bool UseLargeBuffer = false; internal const int NoDynamicOpt = 0; internal const int DynamicBroadcastLevel = 0x1; internal const int DynamicAggregateLevel = 0x2; internal const int DynamicRangePartitionLevel = 0x4; internal const int DynamicHashPartitionLevel = 0x8; internal const int DynamicCoRangePartitionLevel = 0x10; /// /// Runtime optimization: mostly affects dynamic resource management. /// internal static int DynamicOptLevel = DynamicBroadcastLevel; /// /// Number of partitions to use when doing static resource management. /// //@@TODO: dynamic re-partitioning of multiple inputs should use CoHashPartition or CoRangePartition // both are in MSR private repositories, and Yuan recommends the use of CoRangePartition // as it produces more balanced partitioning. // If/when this work is done, DefaultPartitionCount should be retired. internal static int DefaultPartitionCount = 8; /// /// Used by concat to determine whether to repartition the data down to fewer partitions. /// //@@TODO: review and probably choose a more sensible value for this. // Choosing a smaller value should break anything.. just forces repartitioning rather // than a plain-old concatenation of the source partitions. internal static int MaxPartitionCount = 20000; /// /// Use in memory FIFOs where appropriate. /// internal static bool UseMemoryFIFO = false; /// /// Stop execution of vertices in a debugger. /// internal static bool LaunchDebugger = false; // Specifies whether object fields can have null values. // Setting AllowNullFields to true allows all object fields to have // null values. A field can be specified as non-nullable by [Nullable(false)]. // If AllowNullFields is false, all object fields are treated as non-nullable. // A field can be specified as nullable by [Nullable(true)]. internal static bool AllowNullFields = false; internal static bool AllowNullArrayElements = false; /// /// Specifies whether records can have null values. /// /// /// Setting AllowNullRecords to true allows all records to have null values. /// A class can be specified as non-nullable by [Nullable(false)]. /// If AllowNullRecords is false, all records are treated as non-nullable. /// A class can be specified as nullable by [Nullable(true)]. /// internal static bool AllowNullRecords = false; /// /// Allows records to be serialized and retain their concrete type identity /// /// /// If false, records in an IQueryable{T} will be treated as records of type T regardless of their concrete type. /// internal static bool AllowAutoTypeInference = false; /// /// Specifies whether to use aggregation tree to work around some SMB limitation. /// internal static bool UseSMBAggregation = false; /// /// Specifies whether to use partial reduction for Distinct. /// internal static bool UsePartialDistinct = false; /// /// The maximum number of seconds to wait between polling the cluster to see if a job has completed. /// internal static int JobCompletionMaxPollInterval = 20; // The local reduction strategy used by GroupBy. internal static CombinerKind GroupByReduceStrategy = CombinerKind.PartialHash; internal static bool GroupByDynamicReduce = false; internal static bool GroupByLocalAggregationIsPartial = true; /// /// Additional DryadLinq related command line arguments for XmlExecHost.exe. /// private static string XmlExecHostArgsAdditional = String.Empty; internal static string XmlExecHostArgs { get { return XmlExecHostArgsAdditional; } } internal static void AddXmlExecHostArg(string arg) { XmlExecHostArgsAdditional += arg; } internal static TimeSpan LeaseDurationForTempFiles = new TimeSpan(1, 0, 0, 0); // 1 day. } /// /// Specifies a reduction strategy for GroupBy. /// internal enum CombinerKind { /// /// Partial sort GroupBy. /// PartialSort, /// /// Partial hash GroupBy. /// PartialHash, /// /// Full hash GroupBy. /// FullHash } /// /// Contains references to class/method/field names that are referenced via reflection. /// This is intended to assist with refactoring that may break reflection. /// /// NOTE: this list will probably never be complete. /// - A method mentioned here is definitely accessed via reflection /// - Do not assume that methods not listed here are not accessed via Reflection. /// internal class ReflectedNames { internal const string DataProvider_GetPartitionedTable = "GetPartitionedTable"; internal const string DataProvider_Ingress = "Ingress"; internal const string DLQ_ToStore = "ToStoreInternal"; } }