Пример #1
0
        public void Notify(Guid idSession, int idOperation, string[] outputs)
        {
            lock (lockUpdateStatus)
            {
                OperationStatus operationSt = sessionStatus[idSession].operationStatus[idOperation];
                if (outputs != null)
                {
                    SessionUtilities.OperationCompleted(operationSt, outputs);
                    ComputationGraph session = sessionDictionary[idSession];
                    SessionUtilities.UpdateMnemonicValues(sessionStatus[idSession].mnemonicsTable,
                                                          session.Operations[idOperation].Output,
                                                          outputs);
                    GetLogSession(idSession);

                    if (!SessionUtilities.SessionCompleted(sessionStatus[idSession].operationStatus))
                    {
                        List <int> idAvailableOperation = SessionUtilities.GetIDAvailableOperation(
                            sessionStatus[idSession].operationStatus,
                            sessionDictionary[idSession].Dependecies);
                        OperationsToExecute(idSession, idAvailableOperation);
                    }
                    else
                    {
                        StopSession(idSession);
                    }
                }
                else
                {
                    SessionUtilities.OperationFaild(operationSt);
                    StopSession(idSession);
                }
            }
        }
Пример #2
0
        public Guid StartSession(ComputationGraph session)
        {
            Guid idSession = Guid.NewGuid();

            lock (lockListSession)
            {
                sessionDictionary.Add(idSession, session);
            }
            _logger.LogInformation($"Create session with id: {idSession}");
            List <OperationStatus> opStatus = new List <OperationStatus>();

            foreach (Operation operation in session.Operations)
            {
                opStatus.Add(new OperationStatus(operation.Id, StatusEnum.Awaits));
            }
            lock (lockUpdateStatus)
            {
                sessionStatus.Add(idSession, new SessionStatus(opStatus, session.MnemonicsValues));
            }

            GetLogSession(idSession);

            lock (lockListSession)
            {
                List <int> idAvailableOperation = SessionUtilities.GetIDAvailableOperation(
                    sessionStatus[idSession].operationStatus,
                    sessionDictionary[idSession].Dependecies);
                OperationsToExecute(idSession, idAvailableOperation);
            }
            return(idSession);
        }