From 1f5fabf5eab77586dbc4b52746d9eea62b46d58a Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 29 Sep 2022 15:21:51 +0000 Subject: [PATCH] --- .vscode/launch.json | 8 +-- devdocs/todo.txt | 13 ++-- server/AyaNova/util/Seeder.cs | 114 +++++++++++++++++++++++++++++++++- 3 files changed, 121 insertions(+), 14 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0589e4b5..ce4235a9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -64,7 +64,7 @@ "AYANOVA_USE_URLS": "http://*:7575;", //"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", //"AYANOVA_REMOVE_LICENSE_FROM_DB":"true", - "AYANOVA_SERVER_TEST_MODE": "true", + //"AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8", //"AYANOVA_REPORT_RENDERING_TIMEOUT":"1", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", @@ -121,9 +121,9 @@ "AYANOVA_USE_URLS": "http://*:7575;", //"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", //"AYANOVA_REMOVE_LICENSE_FROM_DB":"true", - // "AYANOVA_SERVER_TEST_MODE": "true", - "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8", - "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "large", + //"AYANOVA_SERVER_TEST_MODE": "true", + "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", + "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin" }, "sourceFileMap": { diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 5dfdf297..97b01870 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -1,15 +1,14 @@ # now -todo: case 4192 add progress feedback and cancellation to running jobs +todo: case 4200 Morrow dashboard issue + generate MEGA level data 100k workorders with many overdue + then try out dashboard, it likely is missing some kind of limiter or timeout maximum + or query is just inefficient + + todo: case 4193 In job log add cancel button for running jobs or someway of doing it from there should be able to see active jobs at a glance, how long running, who started if applicable and cancel -todo: what the hell is morrow doing? CPU pegged at 100% for all night now - could it be retagging or bulk op of some kind with huge wo dataset? - -todo: stop sending renewal reminders, shareit does that for us no need to make more work - look into v7 license key messages and make sure it doesn't say that, also take out any info about manual license install - remove anything not requried to be there to shorten it drastically. todo: rockfish new product codes not available for building a email address csv by product code look into that as need it for perpetual, maybe an even better way to do it would be to add a new link that just says diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index b2d0c9f4..1ba9901d 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -30,7 +30,7 @@ namespace AyaNova.Util public static class Level { - public enum SeedLevel { NotValid, Small, Medium, Large, Huge }; + public enum SeedLevel { NotValid, Small, Medium, Large, Huge, Mega }; public static SeedLevel StringToSeedLevel(string size) { switch (size.ToLowerInvariant()) @@ -47,6 +47,9 @@ namespace AyaNova.Util case "huge": return SeedLevel.Huge; + case "mega": + return SeedLevel.Mega; + default: return SeedLevel.NotValid; } @@ -480,6 +483,87 @@ namespace AyaNova.Util } break; + case Level.SeedLevel.Mega: + { + #region GenMega + //this is the MEGA dataset for 100k workorder kpi and other testing + //same as huge but with way more customers and service work orders going back longer time frame + //intended to simulate better a v7 customer's real world data to test performance and bug finding + //It is acceptable for this seeding to take many hours as it would normally be used rarely + + //PERF + await LogStatusAsync(JobId, LogJob, log, $"Seeding MEGA sample data...."); + var watch = new Stopwatch(); + watch.Start(); + + + //INSIDE USERS - 730 total inside users here plus couple dozen known users below + //IT administrator, can change ops but nothing else + await SeedUserAsync(log, 10, AuthorizationRoles.OpsAdmin, UserType.NotService, forceEmail, appendPassword); + //business administrator, can view ops issues + await SeedUserAsync(log, 10, AuthorizationRoles.BizAdmin | AuthorizationRoles.OpsAdminRestricted, UserType.NotService, forceEmail, appendPassword); + //owner / upper management who doesn't control anything but views stuff + await SeedUserAsync(log, 20, AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted | AuthorizationRoles.OpsAdminRestricted, UserType.NotService, forceEmail, appendPassword); + + //////////////////////////////////////////////// + //TECHS (LICENSE CONSUMERS) + // + // + + //########### WARNING: if more than 250 techs must update Rockfish::ravenkeyfactory::GetRavenTrialKey to allow for more + //regular techs + await SeedUserAsync(log, 15, AuthorizationRoles.Tech | AuthorizationRoles.ServiceRestricted, UserType.Service, forceEmail, appendPassword); + //Restricted techs + await SeedUserAsync(log, 2, AuthorizationRoles.TechRestricted | AuthorizationRoles.ServiceRestricted, UserType.Service, forceEmail, appendPassword); + //subcontractors + await SeedUserAsync(log, 2, AuthorizationRoles.SubContractor, UserType.ServiceContractor, forceEmail, appendPassword); + //Restricted subcontractors + await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorRestricted, UserType.ServiceContractor, forceEmail, appendPassword); + /////////////////////////////////////////// + + //generic office people people + await SeedUserAsync(log, 500, AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted, UserType.NotService, forceEmail, appendPassword); + //20 Full sales people + await SeedUserAsync(log, 60, AuthorizationRoles.Sales, UserType.NotService, forceEmail, appendPassword); + //10 Restricted sales people + await SeedUserAsync(log, 10, AuthorizationRoles.SalesRestricted, UserType.NotService, forceEmail, appendPassword); + //Service manager + await SeedUserAsync(log, 20, AuthorizationRoles.Service | AuthorizationRoles.InventoryRestricted, UserType.NotService, forceEmail, appendPassword); + //Inventory manager + await SeedUserAsync(log, 40, AuthorizationRoles.Inventory | AuthorizationRoles.ServiceRestricted, UserType.NotService, forceEmail, appendPassword); + //Inventory manager assistants + await SeedUserAsync(log, 20, AuthorizationRoles.InventoryRestricted, UserType.NotService, forceEmail, appendPassword); + //accountant / bookkeeper + await SeedUserAsync(log, 20, AuthorizationRoles.Accounting | AuthorizationRoles.BizAdminRestricted, UserType.NotService, forceEmail, appendPassword); + + await SeedVendorAsync(log, 5000, forceEmail); + await SeedUnitModelAsync(log, 400); + + //######### WARNING trial license size limits: Each Head office is up to 3 users generated, each customer is up to 1 generated so assume fully generated + await SeedCustomerAsync(log, 10000, slevel, forceEmail, appendPassword);//## WARNING AFFECTS LICENSE potentially 10,000 CUSTOMER users + await SeedHeadOfficeAsync(log, 500, slevel, forceEmail, appendPassword);//## WARNING AFFECTS LICENSE potentially 1500 CUSTOMER users + + await SeedProjectAsync(log, 1000); + await SeedServiceRateAsync(log, 200); + await SeedTravelRateAsync(log, 100); + + await SeedLoanLoanUnitAsync(log, 200); + await SeedCustomerServiceRequestAsync(log, 200, forceEmail, appendPassword);//## WARNING AFFECTS LICENSE potentially 200 CUSTOMER users from this + await SeedPartWarehouseAsync(log, 200); + await SeedPartAsync(log, 10000, 1000); + await SeedPartAssemblyAsync(log, 500); + await SeedPurchaseOrderAsync(log, 1000); + await SeedQuoteAsync(log, 10); + await SeedPMAsync(log, 3);//DO NOT want too many of these as they affect performance + await SeedWorkOrderAsync(log, slevel); + + //PERF + watch.Stop(); + await LogStatusAsync(JobId, LogJob, log, "MEGA level sample data seeded in " + AyaNova.Util.DateUtil.FormatTimeSpan(watch.Elapsed)); + #endregion genMEGA + } + break; + } //Seed logo files @@ -1758,7 +1842,7 @@ namespace AyaNova.Util { User u = new User(); u.Active = active; - u.AllowLogin=true; + u.AllowLogin = true; do { u.Name = Fake.Name.FullName(); @@ -1910,6 +1994,7 @@ namespace AyaNova.Util break; case Level.SeedLevel.Large: case Level.SeedLevel.Huge: + case Level.SeedLevel.Mega: await SeedUnitAsync(log, 10, NewObject.Id); break; } @@ -2825,6 +2910,7 @@ namespace AyaNova.Util int MaximumWorkOrderItemCount = 2; int woItemUnitCount = 2; + bool IsMegaSeedLevel = false; switch (seedLevel) { case Level.SeedLevel.Medium: @@ -2842,6 +2928,14 @@ namespace AyaNova.Util MaximumWorkOrderItemCount = 2; woItemUnitCount = 1; break; + case Level.SeedLevel.Mega: + //intention is to have at least 100000 (100k) workorders in system + //so over 10 years 3650 days that needs to be 27.2 per day + PastMonthsToSeed = 121; + MaximumWorkOrderItemCount = 2; + woItemUnitCount = 1; + IsMegaSeedLevel = true; + break; } DateTime seedStartWindow = DateTime.UtcNow.AddMonths(-PastMonthsToSeed);//goes back based on seed level @@ -2855,6 +2949,9 @@ namespace AyaNova.Util for (int x = 0; x < totalDays; x++) { int thisDayGenerateThisMany = Fake.Random.Int(0, 3) + 3; + if (IsMegaSeedLevel) + thisDayGenerateThisMany = 27;//to get to 100k + for (int perDay = 0; perDay < thisDayGenerateThisMany; perDay++) { WorkOrder o = new WorkOrder(); @@ -3257,7 +3354,18 @@ namespace AyaNova.Util //if it's in the past tag it with a completed type status if (olderThanOneWeekAgo) { - if (Fake.Random.Int(1, 10) != 3) //10% overdue for showing off widget overdue + bool IsClosed = true; + + if (IsMegaSeedLevel) + { + IsClosed = (Fake.Random.Int(1, 10) > 3); //30% overdue for hammering some widget queries as a test + } + else + { + IsClosed = (Fake.Random.Int(1, 10) != 3); //10% overdue for showing off widget overdue + } + + if (IsClosed) //10% overdue for showing off widget overdue { var WoState = new WorkOrderState() {