public async Task Wait()
        {
            var config = new TestConfig();
            var client = new Client(config.Token);
            var parent = string.Join("\\", config.Project, _root, Guid.NewGuid().ToString("N"));

            var processor = new WorkItemProcessor(client, config.Organization, config.Project, new FieldsResolver(client, config.Organization, config.Project), Substitute.For <IRelationsProcessors>(), Substitute.For <IMapper>());
            await processor.Process(config.Organization, config.Project, new WorkItemUpdate
            {
                Id     = 1,
                Fields = new Dictionary <string, Value>
                {
                    ["System.AreaPath"] = new Value {
                        NewValue = parent
                    },
                    ["System.AssignedTo"]   = new Value(),
                    ["System.WorkItemType"] = new Value {
                        NewValue = "Product Backlog Item"
                    },
                    ["System.Title"] = new Value {
                        NewValue = "new"
                    },
                    ["System.Description"] = new Value {
                        NewValue = ""
                    }
                }
            });
        }
Example #2
0
        public WorkQueue(WorkItemProcessor processor, int threads)
        {
            _threadCount = threads;

            _processor = processor;

            _queueLock = new object();
            _queue     = new Queue <T>();
        }
Example #3
0
        public WorkQueue(WorkItemProcessor processor, int threads)
        {
            _threadCount = Math.Max(1, Math.Min(Environment.ProcessorCount * 2, threads));

            _processor = processor;

            _queueLock = new object();
            _queue     = new Queue <T>();
        }
Example #4
0
        public async Task Run()
        {
            var config = new TestConfig();

            var client    = new Client(config.Token);
            var mapper    = Substitute.For <IMapper>();
            var processor = new WorkItemProcessor(client, config.Organization, config.Project, new FieldsResolver(client, config.Organization, config.Project), new RelationsProcessors(client, mapper), mapper);
            await processor.Process(config.Organization, config.Project,
                                    Clone.FromFile(Path.Join("items", "2195", "1.json")));
        }
Example #5
0
    private AstarPath()
    {
        pathReturnQueue = new PathReturnQueue(this);

        pathProcessor = new PathProcessor(this, pathReturnQueue, 1, false);

        workItems    = new WorkItemProcessor(this);
        graphUpdates = new GraphUpdateProcessor(this);

        graphUpdates.OnGraphsUpdated += () => {
            if (OnGraphsUpdated != null)
            {
                OnGraphsUpdated(this);
            }
        };
    }
Example #6
0
        private static async Task RunPush(string organization, string token, string project, string output)
        {
            var client = new Client(token);

            await using var context = new MigrationContext(output);
            context.ChangeTracker.AutoDetectChangesEnabled = false;

            var mapper = new Mapper(context);

            WriteLine("Uploading attachments...");
            var start = Stopwatch.StartNew();

            await foreach (var(position, total) in AttachmentsProcessor.UploadAttachments(client, organization, project, context, output))
            {
                SetCursorPosition(0, CursorTop);
                Write($"[{position}/{total}] {(start.Elapsed / position * (total - position)).Humanize(2)} remaining".PadRight(BufferWidth - 1));
            }

            WriteLine();
            WriteLine($"Done in {start.Elapsed.Humanize()}");

            try
            {
                start.Restart();
                WriteLine("Replaying operations...");

                var processor = new WorkItemProcessor(client, organization, project, new FieldsResolver(client, organization, project), new RelationsProcessors(client, mapper), mapper);
                await foreach (var(position, total) in Push.Run(organization, project, output, context, processor))
                {
                    SetCursorPosition(0, CursorTop);
                    Write($"[{position}/{total}] {(start.Elapsed / position * (total - position)).Humanize(2)} remaining".PadRight(BufferWidth - 1));
                }
            }
            finally
            {
                await context.SaveChangesAsync();
            }

            WriteLine();
            WriteLine($"Done in {start.Elapsed.Humanize()}");
        }
        public async Task <SprintProgressVm> SetSprintProgressVm(IJSRuntime jsRuntime, string uri)
        {
            _jsRuntime = jsRuntime;
            _sprintIterationProcessor = new SprintIterationProcessor();
            _workItemProcessor        = new WorkItemProcessor();
            SprintProgressDto sprintProgressDto;

            if (uri.Contains("localhost"))
            {
                sprintProgressDto = MockData.GetSprintProgressDtoTest();
            }
            else
            {
                sprintProgressDto = await GetSprintProgressDtoLive();
            }

            var sprintProgressVm = GetSprintProgressVm(sprintProgressDto);

            //do not delete the following DEBUG line!
            //sprintProgressVm.DebugString = JsonConvert.SerializeObject(sprintProgressDto, Formatting.Indented);

            return(sprintProgressVm);
        }
Example #8
0
        static void Main(string[] args)
        {
            Bootstrap bootstrap = new Bootstrap();

            bootstrap.Configure();

            LogManager.GetLog = Log4NetLogManager.GetLogger;

            using (var ctx = new WorkItemContext())
            {
                ctx.Database.CreateIfNotExists();

                for (int i = 0; i < 100; i++)
                {
                    var item = new WorkItem
                    {
                        Priority      = WorkItemPriorityEnum.High,
                        ScheduledTime = DateTime.Now.AddSeconds(i * 1),
                        Status        = WorkItemStatusEnum.Pending,
                        Type          = "DicomSend",
                        Request       = new DicomSendRequest(),
                        Progress      = new DicomSendProgress()
                    };
                    ctx.WorkItems.Add(item);
                }

                ctx.SaveChanges();
            }

            Console.WriteLine("Start WorkItem Processor!");

            WorkItemProcessor.CreateProcessor(5, 5, "workItem");
            WorkItemProcessor.Instance.Run();

            Console.WriteLine("Press any key to exit!");
            Console.Read();
        }
Example #9
0
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessSeedWorkItem(this);
 }
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessCreateInternetGatewayModelWorkItem(this);
 }
Example #11
0
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessQueryAllSecurityGroupsWorkItem(this);
 }
Example #12
0
 public WorkQueue(WorkItemProcessor processor)
     : this(processor, Environment.ProcessorCount)
 {
 }
 public void Handle(WorkItemProcessor processor, WorkItem item)
 {
     processor.CurrentState = item.CompletenessConditionHoldsTrue ? (IState)this : new CancelState();
 }
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessCreateNetworkAclModelWorkItem(this);
 }
Example #15
0
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessQueryAllNetworkAclsWorkItem(this);
 }
Example #16
0
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessQueryAllRouteTablesWorkItem(this);
 }
Example #17
0
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessCreateVpcModelWorkItem(this);
 }
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessCreateDbInstanceModelWorkItem(this);
 }
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessCreateRouteTableModelWorkItem(this);
 }
Example #20
0
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessCreateSecurityGroupModelWorkItem(this);
 }
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessQueryAllVpcsWorkItem(this);
 }
 public void Process(WorkItemProcessor processor)
 {
     processor.ProcessQueryAllDbInstancesWorkItem(this);
 }