<commit_before>﻿using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SFA.DAS.EAS.Portal.DependencyResolution;
using SFA.DAS.EAS.Portal.Worker.Startup;
using SFA.DAS.EAS.Portal.Startup;
using SFA.DAS.EAS.Portal.Worker.StartupJobs;
using System;

namespace SFA.DAS.EAS.Portal.Worker
{
    class Program
    {
        static async Task Main(string[] args)
        {
            IHost host = null;
            try
            {
                host = CreateHostBuilder(args).Build();

                await host.StartAsync();

                var jobHost = host.Services.GetService<IJobHost>();
                await jobHost.CallAsync(nameof(CreateReadStoreDatabaseJob.CreateReadStoreDatabase));

                await host.WaitForShutdownAsync();               

            }
            catch(Exception ex)
            {
                System.Diagnostics.Trace.TraceError(ex.Message + ex.StackTrace);
                throw;
            }
            finally
            {
                if (host != null)
                {
                    host.Dispose();
                }
            }
          
        }

        private static IHostBuilder CreateHostBuilder(string[] args) =>
            new HostBuilder()
                .ConfigureDasWebJobs()
                .ConfigureDasAppConfiguration(args)
                .ConfigureDasLogging()
                .UseApplicationInsights()
                .UseDasEnvironment()
                .UseConsoleLifetime()
                .ConfigureServices(s => s.AddApplicationServices())
                .ConfigureServices(s => s.AddCosmosDatabase())
                .ConfigureServices(s => s.AddDasNServiceBus());
    }
}<commit_msg>no need to use TraceError, the exception will be logged to the set up nlog targets, currently console, log file and redis/kibana<commit_after>﻿using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SFA.DAS.EAS.Portal.DependencyResolution;
using SFA.DAS.EAS.Portal.Worker.Startup;
using SFA.DAS.EAS.Portal.Startup;
using SFA.DAS.EAS.Portal.Worker.StartupJobs;

namespace SFA.DAS.EAS.Portal.Worker
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using (var host = CreateHostBuilder(args).Build())
            {
                await host.StartAsync();

                var jobHost = host.Services.GetService<IJobHost>();
                await jobHost.CallAsync(nameof(CreateReadStoreDatabaseJob.CreateReadStoreDatabase));

                await host.WaitForShutdownAsync();
            }
        }

        private static IHostBuilder CreateHostBuilder(string[] args) =>
            new HostBuilder()
                .ConfigureDasWebJobs()
                .ConfigureDasAppConfiguration(args)
                .ConfigureDasLogging()
                .UseApplicationInsights()
                .UseDasEnvironment()
                .UseConsoleLifetime()
                .ConfigureServices(s => s.AddApplicationServices())
                .ConfigureServices(s => s.AddCosmosDatabase())
                .ConfigureServices(s => s.AddDasNServiceBus());
    }
}
{'fraction_non_alphanumeric': 0.09310872894333844, 'fraction_numerical': 0.0, 'mean_word_length': 1.9005328596802842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '118984', 'n_tokens_mistral': 907, 'n_tokens_neox': 861, 'n_words': 149}