<commit_before>﻿namespace King.Service.CloudService.Role
{
    using King.Azure.Data;
    using King.Service;
    using King.Service.CloudService.Role.Queue;
    using King.Service.CloudService.Role.Scalable;
    using King.Service.Data;
    using System.Collections.Generic;

    public class Factory : ITaskFactory<Configuration>
    {
        public IEnumerable<IRunnable> Tasks(Configuration config)
        {
            var tasks = new List<IRunnable>();

            // Initialization task
            tasks.Add(new InitTask());

            // Initialize Table; creates table if it doesn't already exist
            tasks.Add(new InitializeStorageTask(new TableStorage(config.TableName, config.ConnectionString)));

            // Initialize Container; creates container if it doesn't already exist
            tasks.Add(new InitializeStorageTask(new Container(config.ContainerName, config.ConnectionString)));

            //basic task
            tasks.Add(new Recurring());

            //Cordinated Tasks between Instances
            var task = new Coordinated(config.ConnectionString);

            // Add once to ensure that Table is created for Instances to communicate with
            tasks.AddRange(task.Tasks());

            // Add your coordinated task
            tasks.Add(task);

            //Task once daily on the (specified/current) hour
            tasks.Add(new OnceDaily(config.ConnectionString));

            //Backoff task
            tasks.Add(new Backoff());

            //Self governing task
            tasks.Add(new Adaptive());

            //Dequeue task, Backoff behavior
            tasks.Add(new BackoffRunner(new CompanyDequeuer(new StorageQueue(config.GenericQueueName, config.ConnectionString))));

            //Dequeue task, Adaptive behavior
            tasks.Add(new AdaptiveRunner(new CompanyDequeuer(new StorageQueue(config.GenericQueueName, config.ConnectionString))));

            //Dequeue task, Recurring behavior
            tasks.Add(new RecurringRunner(new CompanyDequeuer(new StorageQueue(config.GenericQueueName, config.ConnectionString))));

            //Auto Scaling Task
            tasks.Add(new DynamicScaler(config));
            
            ///Dequeue Tasks Example
            var f = new DequeueFactory(config.ConnectionString);
            tasks.AddRange(f.Dequeue<CompanyProcessor, CompanyModel>(config.SlowQueueName));
            tasks.AddRange(f.Dequeue<CompanyProcessor, CompanyModel>(config.ModerateQueueName, QueuePriority.Medium));
            tasks.AddRange(f.Dequeue<CompanyProcessor, CompanyModel>(config.FastQueueName, QueuePriority.High));

            //Tasks for Queuing (Demo purposes)
            tasks.Add(new CompanyQueuer(new StorageQueue(config.GenericQueueName, config.ConnectionString)));
            tasks.Add(new CompanyQueuer(new StorageQueue(config.FastQueueName, config.ConnectionString)));
            tasks.Add(new CompanyQueuer(new StorageQueue(config.ModerateQueueName, config.ConnectionString)));
            tasks.Add(new CompanyQueuer(new StorageQueue(config.SlowQueueName, config.ConnectionString)));

            return tasks;
        }
    }
}<commit_msg>Less code<commit_after>﻿namespace King.Service.CloudService.Role
{
    using King.Azure.Data;
    using King.Service;
    using King.Service.CloudService.Role.Queue;
    using King.Service.CloudService.Role.Scalable;
    using King.Service.Data;
    using System.Collections.Generic;

    public class Factory : ITaskFactory<Configuration>
    {
        public IEnumerable<IRunnable> Tasks(Configuration config)
        {
            var tasks = new List<IRunnable>(new IRunnable[] {
                // Initialization task
                new InitTask(),

                // Initialize Table; creates table if it doesn't already exist
                new InitializeStorageTask(new TableStorage(config.TableName, config.ConnectionString)),

                // Initialize Container; creates container if it doesn't already exist
                new InitializeStorageTask(new Container(config.ContainerName, config.ConnectionString)),

                //basic task
                new Recurring(),
            
                //Task once daily on the (specified/current) hour
                new OnceDaily(config.ConnectionString),

                //Backoff task
                new Backoff(),

                //Self governing task
                new Adaptive(),

                //Dequeue task, Backoff behavior
                new BackoffRunner(new CompanyDequeuer(new StorageQueue(config.GenericQueueName, config.ConnectionString))),

                //Dequeue task, Adaptive behavior
                new AdaptiveRunner(new CompanyDequeuer(new StorageQueue(config.GenericQueueName, config.ConnectionString))),

                //Dequeue task, Recurring behavior
                new RecurringRunner(new CompanyDequeuer(new StorageQueue(config.GenericQueueName, config.ConnectionString))),

                //Auto Scaling Task
                new DynamicScaler(config),
            
                //Tasks for Queuing (Demo purposes)
                new CompanyQueuer(new StorageQueue(config.GenericQueueName, config.ConnectionString)),
                new CompanyQueuer(new StorageQueue(config.FastQueueName, config.ConnectionString)),
                new CompanyQueuer(new StorageQueue(config.ModerateQueueName, config.ConnectionString)),
                new CompanyQueuer(new StorageQueue(config.SlowQueueName, config.ConnectionString)),
            });

            ///Dequeue Tasks Example
            var f = new DequeueFactory(config.ConnectionString);
            tasks.AddRange(f.Dequeue<CompanyProcessor, CompanyModel>(config.SlowQueueName));
            tasks.AddRange(f.Dequeue<CompanyProcessor, CompanyModel>(config.ModerateQueueName, QueuePriority.Medium));
            tasks.AddRange(f.Dequeue<CompanyProcessor, CompanyModel>(config.FastQueueName, QueuePriority.High));


            //Cordinated Tasks between Instances
            var task = new Coordinated(config.ConnectionString);
            // Add once to ensure that Table is created for Instances to communicate with
            tasks.AddRange(task.Tasks());
            // Add your coordinated task
            tasks.Add(task);

            return tasks;
        }
    }
}
{'fraction_non_alphanumeric': 0.08623417721518987, 'fraction_numerical': 0.0, 'mean_word_length': 2.4315960912052117, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '126361', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1460, 'n_words': 352}