Exemple #1
0
        public void StartSingleInstance()
        {
            System.Console.WriteLine("Start Test : Start Single Instance");
            var obj = new
            {
                base_url     = "/",
                NotebookDir  = TestDir + System.IO.Path.DirectorySeparatorChar + "HelloWorld.ipynb",
                ResourcePath = JNBFirstFile
            };

            JupyterNotebookTool.StartTaskAsync((int)TaskTypes.Start, JNBFirstFile, (JObject)JObject.FromObject(obj));
            System.Threading.Thread.Sleep(2000);
            Assert.True(JupyterNotebookTool.IsPortBusyInRange(8888, 8888, 8890));
            Assert.Equal(JupyterNotebookTool.GetTasks().Count, 1);
            System.Console.WriteLine("End Test : Start Single Instance");
        }
Exemple #2
0
        public void StartAllAllowedInstances()
        {
            JupyterNotebookTool = new JupyterNotebook("http://localhost", "/jnb", new int[] { 8888, 8890 });
            System.Console.WriteLine("Start Test : StartAllAllowedInstances");
            var obj = new
            {
                base_url     = "/",
                NotebookDir  = TestDir + System.IO.Path.DirectorySeparatorChar + "HelloWorld.ipynb",
                ResourcePath = JNBFirstFile
            };

            JupyterNotebookTool.StartTaskAsync((int)TaskTypes.Start, JNBFirstFile, (JObject)JObject.FromObject(obj));
            System.Threading.Thread.Sleep(2000);
            Assert.True(JupyterNotebookTool.IsPortBusyInRange(8888, 8888, 8890));

            var obj2 = new
            {
                base_url     = "/",
                NotebookDir  = TestDir + System.IO.Path.DirectorySeparatorChar + "HelloWorld2.ipynb",
                ResourcePath = JNBSecondFile
            };

            JupyterNotebookTool.StartTaskAsync((int)TaskTypes.Start, JNBSecondFile, (JObject)JObject.FromObject(obj2));
            System.Threading.Thread.Sleep(2000);
            Assert.True(JupyterNotebookTool.IsPortBusyInRange(8889, 8888, 8890));

            var obj3 = new
            {
                base_url     = "/",
                NotebookDir  = TestDir + System.IO.Path.DirectorySeparatorChar + "HelloWorld3.ipynb",
                ResourcePath = JNBThirdFile
            };

            JupyterNotebookTool.StartTaskAsync((int)TaskTypes.Start, JNBThirdFile, (JObject)JObject.FromObject(obj3));
            System.Threading.Thread.Sleep(2000);
            Assert.True(JupyterNotebookTool.IsPortBusyInRange(8890, 8888, 8890));
            System.Console.WriteLine("End Test : StartAllAllowedInstances");
        }