コード例 #1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Usage();
                return;
            }

            if (args.Length >= 2)
            {
                TrinityConfig.StorageRoot = args[1];
            }
            Global.LoadTSLStorageExtension(args[0]);
            Global.LocalStorage.LoadStorage();

            TrinityConfig.HttpPort = 80;
            FanoutSearchModule.EnableExternalQuery(true);
            FanoutSearchModule.SetQueryTimeout(3000);
            FanoutSearchModule.RegisterIndexService(Indexer);
            FanoutSearch.LambdaDSL.SetDialect("g", "v", "outV", "outE", "Action");

            TrinityServer server = new TrinityServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: sefira/NeuralMovieQAQ
        static void Main(string[] args)
        {
            FanoutSearchModule.EnableExternalQuery(true);
            FanoutSearchModule.SetQueryTimeout(30000);
            FanoutSearchModule.RegisterIndexService(Indexer);
            FanoutSearchModule.RegisterExpressionSerializerFactory(() => new ExpressionSerializer());
            LambdaDSL.SetDialect("MyGraph", "StartFrom", "VisitNode", "FollowEdge", "Action");

            TrinityConfig.HttpPort = 80;
            var server = new TrinityServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();

            if (!Trinity.Global.LocalStorage.LoadStorage() || !Trinity.Global.LocalStorage.Movie_Accessor_Selector().Any())
            {
                Trinity.Global.LocalStorage.LoadStorage();
                ImportMovieData(@"D:\MovieDomain\GraphEngineServer\bin\Debug\");
                Trinity.Global.LocalStorage.SaveStorage();
            }
            else
            {
                Console.WriteLine("=============================Movie had been imported once. Skipping this turn.");
            }
            //TestMovieData(@"D:\MovieDomain\GraphEngineServer\bin\Debug\");

            //ImportToyData();
            //PrepareSeedEntity();
        }
コード例 #3
0
ファイル: Fixture.cs プロジェクト: chaosddp/GraphEngine
 public TrinityServerFixture()
 {
     Global.Initialize();
     LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
     FanoutSearchModule.SetQueryTimeout(-1);
     FanoutSearchModule.RegisterIndexService(FakeIndexService);
     server = new TrinityServer();
     server.RegisterCommunicationModule <FanoutSearchModule>();
     server.Start();
 }
コード例 #4
0
        internal static void Initialize()
        {
            Global.Initialize();
            LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
            FanoutSearchModule.SetQueryTimeout(-1);
            FanoutSearchModule.RegisterIndexService(FakeIndexService);
            FanoutSearchModule.RegisterExpressionSerializerFactory(() => new ExpressionSerializer());
            TrinityServer server = new TrinityServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: afcentry/Test
        static unsafe void Main(string[] args)
        {
            //TrinityConfig.LoggingLevel = LogLevel.Debug;
            for (int i = -10; i < 10; i++)
            {
                Tweet t = new Tweet(cell_id: i, Content: $"推文正文:{i}", TweetTime: DateTime.Now);
                Global.LocalStorage.SaveTweet(t);
            }
            Global.LocalStorage.SaveStorage();
            FanoutSearchModule.EnableExternalQuery(true);
            LambdaDSL.SetDialect("LessNet", "Start", "Node", "Edge", "Action");
            FanoutSearchModule.SetQueryTimeout(3000);
            //FanoutSearchModule.RegisterIndexService(Indexer);
            FanoutSearchModule.RegisterExpressionSerializerFactory(ExpressionSerializerFactory);
            TwitterDatabaseServer server = new TwitterDatabaseServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();
        }
コード例 #6
0
        public void Initialize(string LogDirectory, string StorageRoot, bool LogEchoOnConsole, Trinity.Diagnostics.LogLevel LogLevel)
        {
            if (!_isInitialized)
            {
                TrinityConfig.LogEchoOnConsole      = LogEchoOnConsole;
                LoggingConfig.Instance.LogDirectory = LogDirectory;
                LoggingConfig.Instance.LoggingLevel = LogLevel;
                StorageConfig.Instance.StorageRoot  = StorageRoot;

                Global.Initialize();

                LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
                FanoutSearchModule.SetQueryTimeout(-1);

                TrinityServer server = new TrinityServer();
                server.RegisterCommunicationModule <FanoutSearchModule>();
                server.Start();

                _isInitialized = true;
            }
        }
コード例 #7
0
        private static void Initialize()
        {
            //  Setup LIKQ index service
            FanoutSearchModule.RegisterIndexService(IndexService);
            //  Set LIKQ starting node keyword to 'Freebase'
            LambdaDSL.SetDialect("Freebase", "StartFrom", "VisitNode", "FollowEdge", "Action");
            //  Plug-in Freebase ICell adapter
            FanoutSearchModule.RegisterUseICellOperationMethod(CellGroupAccessor.New);
            //  Plug-in Serialize.Linq expression serializer
            FanoutSearchModule.RegisterExpressionSerializerFactory(ExpressionSerializerFactory);
            //  Configure LIKQ timeout
            FanoutSearchModule.SetQueryTimeout(1000000);

            string storage_path = Path.Combine(Global.MyAssemblyPath, "storage");

            if (Directory.Exists(storage_path) && Directory.GetFileSystemEntries(storage_path).Count() == 0)
            {
                Directory.Delete(storage_path);
            }

            if (!Directory.Exists(storage_path))
            {
                DownloadDataFile();
            }

            Global.LocalStorage.LoadStorage();
            string sqlite_db_path = Path.Combine(storage_path, "freebase.sqlite");

            if (!File.Exists(sqlite_db_path))
            {
                BuildIndex(sqlite_db_path);
            }

            s_dbconn = new SQLiteConnection($"Data Source={sqlite_db_path};Version=3;");
            s_dbconn.Open();

            return;
        }
コード例 #8
0
        public LocalStressTest()
        {
            //Load some data
            Global.LocalStorage.SaveMyCell(0, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(1, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(2, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(3, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(4, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(5, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(6, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(7, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(8, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });
            Global.LocalStorage.SaveMyCell(9, new List <long> {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            }, f2: new List <float> {
                1, 2, 3, 4, 5, 6, 7, 8
            });


            // WARM UP
            _stress_test_impl(10, 10);
            // Set timeout, and disable cache
            FanoutSearchModule.SetCacheEnabled(false);
            FanoutSearchModule.SetQueryTimeout(800);
        }