Changes made in automation environment

This commit is contained in:
2021-04-08 10:13:30 -04:00
parent 5be927d22a
commit 0ff42f148a
3 changed files with 30 additions and 19 deletions

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PartSource.Automation.Services;
namespace PartSource.Automation.Jobs namespace PartSource.Automation.Jobs
{ {
@@ -20,12 +21,14 @@ namespace PartSource.Automation.Jobs
private readonly ILogger<UpdatePricing> _logger; private readonly ILogger<UpdatePricing> _logger;
private readonly PartSourceContext _partSourceContext; private readonly PartSourceContext _partSourceContext;
private readonly ShopifyClient _shopifyClient; private readonly ShopifyClient _shopifyClient;
private readonly EmailService _emailService;
public UpdatePricing(ILogger<UpdatePricing> logger, PartSourceContext partSourceContext, ShopifyClient shopifyClient) public UpdatePricing(ILogger<UpdatePricing> logger, PartSourceContext partSourceContext, ShopifyClient shopifyClient, EmailService emailService)
{ {
_logger = logger; _logger = logger;
_partSourceContext = partSourceContext; _partSourceContext = partSourceContext;
_shopifyClient = shopifyClient; _shopifyClient = shopifyClient;
_emailService = emailService;
} }
public async Task Run() public async Task Run()
@@ -108,6 +111,8 @@ namespace PartSource.Automation.Jobs
products = await _shopifyClient.Products.GetPrevious(); products = await _shopifyClient.Products.GetPrevious();
} }
} }
_emailService.Send("Update Pricing Completed", $"{updateCount} prices were updated");
} }
} }
} }

View File

@@ -68,22 +68,27 @@ namespace PartSource.Automation
.AddAutomation(options => .AddAutomation(options =>
{ {
options.HasBaseInterval(new TimeSpan(0, 1, 0)) options.HasBaseInterval(new TimeSpan(0, 15, 0))
.HasMaxFailures(5) .HasMaxFailures(5)
.HasJob<TestJob>(options => options.HasInterval(5)) //
//.HasJob<SyncronizeProducts>(options => options.HasInterval(new TimeSpan(24, 0, 0)) //.HasJob<SyncronizeProducts>(options => options.HasInterval(new TimeSpan(24, 0, 0))
// .HasJob<ProcessWhiFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)) // .HasJob<ProcessWhiFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0))
//.HasJob<UpdateFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)) //.HasJob<UpdateFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0))
// .HasDependency<ProcessWhiFitment>() // .HasDependency<ProcessWhiFitment>()
// .StartsAt(DateTime.Today.AddHours(8)) // .StartsAt(DateTime.Today.AddHours(8))
//) //)
.HasJob<StatusCheck>(options => options.HasInterval(new TimeSpan(24, 0, 0))
//.HasJob<ExecuteSsisPackages>(options => options.HasInterval(new TimeSpan(24, 0, 0)) .StartsAt(DateTime.Parse("2021-04-01 08:00:00"))
// .HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))) )
//.HasDependency<ExecuteSsisPackages>() .HasJob<ExecuteSsisPackages>(options => options.HasInterval(new TimeSpan(24, 0, 0))
//.StartsAt(DateTime.Now.AddMinutes(15)) .StartsAt(DateTime.Today.AddHours(26))
//) )
.AddApiServer(); .HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))
.HasDependency<ExecuteSsisPackages>()
.StartsAt(DateTime.Today.AddHours(27)
)
);
//.AddApiServer();
}) })
.AddSingleton<EmailService>() .AddSingleton<EmailService>()
@@ -96,9 +101,10 @@ namespace PartSource.Automation
}) })
.ConfigureLogging((builder, logging) => .ConfigureLogging((builder, logging) =>
{ {
//logging.AddEventLog();
logging.AddConsole(); logging.AddConsole();
logging.AddProvider(new AutomationLoggerProvider()); // logging.AddProvider(new AutomationLoggerProvider());
}); });
} }
} }

View File

@@ -5,7 +5,7 @@
}, },
"emailConfiguration": { "emailConfiguration": {
"From": "alerts@ps-shopify.canadaeast.cloudapp.azure.com", "From": "alerts@ps-automation.eastus2.cloudapp.azure.com",
// "To": "tom@soundpress.com,Anas.Bajwa@Partsource.ca", // "To": "tom@soundpress.com,Anas.Bajwa@Partsource.ca",
"To": "tom@tomraterman.com", "To": "tom@tomraterman.com",
"SmtpHost": "localhost" "SmtpHost": "localhost"