Exemple #1
0
 private static EpPlusExcelReader GetReader(IEtlContext context, string fileName, string sheetName = null, int sheetIndex = -1, bool automaticallyTrimAllStringValues = true)
 {
     return(new EpPlusExcelReader(context)
     {
         FileName = fileName,
         Columns = new()
         {
Exemple #2
0
 internal SequentialMergerBuilder(IEtlContext context, string name)
 {
     Merger = new SequentialMerger(context)
     {
         Name         = name,
         SequenceList = new List <ISequence>(),
     };
 }
Exemple #3
0
 internal SequentialMergerBuilder(IEtlContext context, string name)
 {
     Merger = new SequentialMerger(context)
     {
         Name        = name,
         ProcessList = new List <IProducer>(),
     };
 }
Exemple #4
0
 private static EpPlusExcelReader GetReader(IEtlContext context, IStreamProvider streamProvider, string sheetName = null, int sheetIndex = -1, bool automaticallyTrimAllStringValues = true)
 {
     return(new EpPlusExcelReader(context)
     {
         StreamProvider = streamProvider,
         SheetName = sheetName,
         SheetIndex = sheetIndex,
         Columns = new()
         {
Exemple #5
0
 private static EpPlusExcelSheetListReader GetReader(IEtlContext context, string fileName)
 {
     return(new EpPlusExcelSheetListReader(context)
     {
         StreamProvider = new LocalFileStreamProvider()
         {
             FileName = fileName,
         },
         AddRowIndexToColumn = "idx",
     });
 }
Exemple #6
0
        public EtlTransactionScope(IEtlContext context, IProcess process, TransactionScopeKind kind, TimeSpan scopeTimeout, LogSeverity logSeverity)
        {
            Context     = context;
            Process     = process;
            Kind        = kind;
            LogSeverity = logSeverity;
            Timeout     = scopeTimeout;

            if (Kind == TransactionScopeKind.None)
            {
                return;
            }

            var previousId = Transaction.Current?.ToIdentifierString();

            if (Kind == TransactionScopeKind.Suppress && previousId == null)
            {
                return;
            }

            Scope = new TransactionScope((TransactionScopeOption)Kind, scopeTimeout);

            var newId = Transaction.Current?.ToIdentifierString();

            var iocUid = 0;

            switch (kind)
            {
            case TransactionScopeKind.RequiresNew:
                iocUid = Context.RegisterIoCommandStart(Process, IoCommandKind.dbTransaction, null, null, "new transaction started", newId, null,
                                                        "new transaction started");
                break;

            case TransactionScopeKind.Required:
                iocUid = previousId == null || newId != previousId
                        ? Context.RegisterIoCommandStart(Process, IoCommandKind.dbTransaction, null, null, "new transaction started", newId, null,
                                                         "new transaction started")
                        : Context.RegisterIoCommandStart(Process, IoCommandKind.dbTransaction, null, null, "new transaction started and merged with previous", newId, () => new[] { new KeyValuePair <string, object>("previous transaction", previousId) },
                                                         "new transaction started and merged with previous");

                break;

            case TransactionScopeKind.Suppress:
                iocUid = Context.RegisterIoCommandStart(Process, IoCommandKind.dbTransaction, null, null, "transaction suppressed", previousId, null,
                                                        "existing transaction suppressed");
                break;
            }

            Context.RegisterIoCommandSuccess(Process, IoCommandKind.dbTransaction, iocUid, null);
        }
Exemple #7
0
 public static IProducer PersonalAssetsPivot(IEtlContext context)
 {
     return(new RowCreator(context)
     {
         Columns = PersonalAssetsPivotColumns,
         InputRows = new List <object[]>()
         {
             // "id", "personName", "cars", "houses", "kids"
             new object[] { 1, "A", 1, 1, 2 },
             new object[] { null, "C", 2, 1, 3 },
             new object[] { 3, "D", null, 1, 3 },
             new object[] { 4, "E", "6", 1, 3 },
         },
     });
 }
Exemple #8
0
 public static IProducer RoleHierarchy(IEtlContext context)
 {
     return(new RowCreator(context)
     {
         Columns = RoleHierarchyColumns,
         InputRows = new List <object[]>()
         {
             // "id", "code", "level1", "level2", "level3"
             new object[] { 0, "A", "AAA" },
             new object[] { 1, "B", null, "BBB" },
             new object[] { 2, "C", null, null, "CCC" },
             new object[] { 3, "D", null, null, "DDD" },
             new object[] { 4, "E", null, "EEE" },
             new object[] { 5, "F", null, "FFF" },
         },
     });
 }
Exemple #9
0
 public static IProducer PersonEyeColor(IEtlContext context)
 {
     return(new RowCreator(context)
     {
         Columns = PersonEyeColorColumns,
         InputRows = new List <object[]>()
         {
             // "id", "personId", "color"
             new object[] { 0, 0, "yellow" },
             new object[] { 1, 0, "red" },
             new object[] { 2, 0, "green" },
             new object[] { 3, 1, "blue" },
             new object[] { 4, 1, "yellow" },
             new object[] { 5, 2, "black" },
             new object[] { 6, 100, "fake" },
         },
     });
 }
Exemple #10
0
    private static void LogTaskSummary(IEtlContext context, TaskExectionResult result, int longestTaskName)
    {
        var spacing1            = "".PadRight(longestTaskName - result.TaskName.Length);
        var spacing1WithoutName = "".PadRight(longestTaskName);

        if (result.Exceptions.Count == 0)
        {
            context.Log(LogSeverity.Information, null, "{Task}{spacing1} run-time is {Elapsed}, result is {Result}, CPU time: {CpuTime}, total allocations: {AllocatedMemory}, allocation difference: {MemoryDifference}",
                        result.TaskName, spacing1, result.Statistics.RunTime, "success", result.Statistics.CpuTime, result.Statistics.TotalAllocations, result.Statistics.AllocationDifference);
        }
        else
        {
            context.Log(LogSeverity.Information, null, "{Task}{spacing1} run-time is {Elapsed}, result is {Result}, CPU time: {CpuTime}, total allocations: {AllocatedMemory}, allocation difference: {MemoryDifference}",
                        result.TaskName, spacing1, result.Statistics.RunTime, "failed", result.Statistics.CpuTime, result.Statistics.TotalAllocations, result.Statistics.AllocationDifference);
        }

        if (result.IoCommandCounters.Count > 0)
        {
            var maxKeyLength        = result.IoCommandCounters.Max(x => x.Key.ToString().Length);
            var maxInvocationLength = result.IoCommandCounters.Max(x => x.Value.InvocationCount.ToString(SerilogSink.ValueFormatter.DefaultIntegerFormat, CultureInfo.InvariantCulture).Length);

            foreach (var kvp in result.IoCommandCounters.OrderBy(kvp => kvp.Key.ToString()))
            {
                if (kvp.Value.AffectedDataCount != null)
                {
                    context.Log(LogSeverity.Information, null, "{spacing1} {Kind}{spacing2} {InvocationCount}{spacing3}   {AffectedDataCount}", spacing1WithoutName,
                                kvp.Key.ToString(),
                                "".PadRight(maxKeyLength - kvp.Key.ToString().Length, ' '),
                                kvp.Value.InvocationCount,
                                "".PadRight(maxInvocationLength - kvp.Value.InvocationCount.ToString(SerilogSink.ValueFormatter.DefaultIntegerFormat, CultureInfo.InvariantCulture).Length, ' '),
                                kvp.Value.AffectedDataCount);
                }
                else
                {
                    context.Log(LogSeverity.Information, null, "{spacing1} {Kind}{spacing2} {InvocationCount}", spacing1WithoutName,
                                kvp.Key.ToString(),
                                "".PadRight(maxKeyLength - kvp.Key.ToString().Length, ' '),
                                kvp.Value.InvocationCount);
                }
            }
        }
    }
Exemple #11
0
    private static void LogTaskCounters(IEtlContext context, IEtlTask task)
    {
        if (task.IoCommandCounters.Count == 0)
        {
            return;
        }

        const string kind       = "kind";
        const string invocation = "invoc.";
        const string affected   = "affected";

        var maxKeyLength        = Math.Max(kind.Length, task.IoCommandCounters.Max(x => x.Key.ToString().Length));
        var maxInvocationLength = Math.Max(invocation.Length, task.IoCommandCounters.Max(x => x.Value.InvocationCount.ToString(SerilogSink.ValueFormatter.DefaultIntegerFormat, CultureInfo.InvariantCulture).Length));

        context.Log(LogSeverity.Debug, task, "{Kind}{spacing1} {InvocationCount}{spacing2}   {AffectedDataCount}", kind,
                    "".PadRight(maxKeyLength - kind.Length, ' '),
                    invocation,
                    "".PadRight(maxInvocationLength - invocation.Length, ' '),
                    affected);

        foreach (var kvp in task.IoCommandCounters.OrderBy(kvp => kvp.Key.ToString()))
        {
            if (kvp.Value.AffectedDataCount != null)
            {
                context.Log(LogSeverity.Debug, task, "{Kind}{spacing1} {InvocationCount}{spacing2}   {AffectedDataCount}", kvp.Key.ToString(),
                            "".PadRight(maxKeyLength - kvp.Key.ToString().Length, ' '),
                            kvp.Value.InvocationCount,
                            "".PadRight(maxInvocationLength - kvp.Value.InvocationCount.ToString(SerilogSink.ValueFormatter.DefaultIntegerFormat, CultureInfo.InvariantCulture).Length, ' '),
                            kvp.Value.AffectedDataCount);
            }
            else
            {
                context.Log(LogSeverity.Debug, task, "{Kind}{spacing1} {InvocationCount}", kvp.Key.ToString(),
                            "".PadRight(maxKeyLength - kvp.Key.ToString().Length, ' '), kvp.Value.InvocationCount);
            }
        }
    }
 public SortedMemoryAggregationMutator(IEtlContext context)
     : base(context)
 {
 }
Exemple #13
0
 public CustomJob(IEtlContext context)
     : base(context)
 {
 }
Exemple #14
0
 protected AbstractSimpleChangeMutator(IEtlContext context)
     : base(context)
 {
 }
 public ParallelMerger(IEtlContext context)
     : base(context)
 {
 }
Exemple #16
0
 protected AbstractMutator(IEtlContext context)
     : base(context)
 {
 }
Exemple #17
0
 public CustomAction(IEtlContext context)
     : base(context)
 {
 }
Exemple #18
0
 public RowListener(IEtlContext context)
     : base(context)
 {
 }
 protected AbstractJob(IEtlContext context)
     : base(context)
 {
 }
Exemple #20
0
 public BasicScope(IEtlContext context, string topic, string name = null)
     : base(context)
 {
 }
Exemple #21
0
 public InMemoryRowCache(IEtlContext context)
     : base(context)
 {
 }
Exemple #22
0
 public DeleteFile(IEtlContext context)
     : base(context)
 {
 }