public async Task CreateAndRunPipeline()
        {
            const string PipelineName = "Test-Pipeline";
            const string JobName      = "SparkJobName";
            const string ActivityName = "ActivityName";
            string       workspaceUrl = TestEnvironment.WorkspaceUrl;

            var pipelineClient = new PipelineClient(endpoint: new Uri(workspaceUrl), credential: new DefaultAzureCredential());

            var sparkJob         = new SynapseSparkJobReference(SparkJobReferenceType.SparkJobDefinitionReference, JobName);
            var activity         = new SynapseSparkJobDefinitionActivity(ActivityName, sparkJob);
            var pipelineResource = new PipelineResource();

            pipelineResource.Activities.Add(activity);

            Console.WriteLine("Create pipeline if not already exists.");
            await pipelineClient.StartCreateOrUpdatePipelineAsync(PipelineName, pipelineResource);

            Console.WriteLine("Pipeline created");

            Console.WriteLine("Running pipeline.");
            CreateRunResponse runOperation = await pipelineClient.CreatePipelineRunAsync(PipelineName);

            Console.WriteLine("Run started. ID: {0}", runOperation.RunId);
        }
示例#2
0
        public async Task TestPipelineRun()
        {
            PipelineClient client = CreateClient();

            await using DisposablePipeline pipeline = await DisposablePipeline.Create(client, this.Recording);

            CreateRunResponse runResponse = await client.CreatePipelineRunAsync(pipeline.Name);

            Assert.NotNull(runResponse.RunId);
        }
示例#3
0
        private async Task RunPipeline(string pipelineName)
        {
            string endpoint = TestEnvironment.EndpointUrl;

            var pipelineClient = new PipelineClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential());

            Console.WriteLine("Running pipeline.");
            CreateRunResponse runOperation = await pipelineClient.CreatePipelineRunAsync(pipelineName);

            Console.WriteLine("Run started. ID: {0}", runOperation.RunId);
        }
        public async Task RunPipeline()
        {
            const string PipelineName = "Test-Pipeline";
            string       workspaceUrl = TestEnvironment.WorkspaceUrl;

            var pipelineClient = new PipelineClient(endpoint: new Uri(workspaceUrl), credential: new DefaultAzureCredential());

            Console.WriteLine("Running pipeline.");
            CreateRunResponse runOperation = await pipelineClient.CreatePipelineRunAsync(PipelineName);

            Console.WriteLine("Run started. ID: {0}", runOperation.RunId);
        }
示例#5
0
        public async Task RunPipeline()
        {
            #region Snippet:CreatePipelineClientPrep
#if SNIPPET
            // Replace the string below with your actual endpoint url.
            string endpoint = "<my-endpoint-url>";
#else
            string endpoint = TestEnvironment.EndpointUrl;
#endif

            string pipelineName = "Test-Pipeline";
            #endregion

            #region Snippet:CreatePipelineClient
            var client = new PipelineClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential());
            #endregion

            #region Snippet:CreatePipeline
            PipelineCreateOrUpdatePipelineOperation operation       = client.StartCreateOrUpdatePipeline(pipelineName, new PipelineResource());
            Response <PipelineResource>             createdPipeline = await operation.WaitForCompletionAsync();

            #endregion

            #region Snippet:RetrievePipeline
            PipelineResource retrievedPipeline = client.GetPipeline(pipelineName);
            Console.WriteLine("Pipeline ID: {0}", retrievedPipeline.Id);
            #endregion

            #region Snippet:RunPipeline
            Console.WriteLine("Running pipeline.");
            CreateRunResponse runOperation = await client.CreatePipelineRunAsync(pipelineName);

            Console.WriteLine("Run started. ID: {0}", runOperation.RunId);
            #endregion

            #region Snippet:ListPipelines
            Pageable <PipelineResource> pipelines = client.GetPipelinesByWorkspace();
            foreach (PipelineResource pipeline in pipelines)
            {
                Console.WriteLine(pipeline.Name);
            }
            #endregion

            #region Snippet:DeletePipeline
            PipelineDeletePipelineOperation deleteOperation = client.StartDeletePipeline(pipelineName);
            await deleteOperation.WaitForCompletionResponseAsync();

            #endregion
        }
        public async Task TestQueryRuns()
        {
            PipelineClient    pipelineClient = CreatePipelineClient();
            PipelineRunClient runClient      = CreatePipelineRunClient();

            await using DisposablePipeline pipeline = await DisposablePipeline.Create(pipelineClient, this.Recording);

            CreateRunResponse runResponse = await pipelineClient.CreatePipelineRunAsync(pipeline.Name);

            Assert.NotNull(runResponse.RunId);

            PipelineRunsQueryResponse queryResponse = await runClient.QueryPipelineRunsByWorkspaceAsync(new RunFilterParameters (DateTimeOffset.MinValue, DateTimeOffset.MaxValue));

            Assert.GreaterOrEqual(queryResponse.Value.Count, 1);
        }
        public async Task TestCancelRun()
        {
            PipelineClient    pipelineClient = CreatePipelineClient();
            PipelineRunClient runClient      = CreatePipelineRunClient();

            await using DisposablePipeline pipeline = await DisposablePipeline.Create(pipelineClient, this.Recording);

            CreateRunResponse runResponse = await pipelineClient.CreatePipelineRunAsync(pipeline.Name);

            Assert.NotNull(runResponse.RunId);

            Response response = await runClient.CancelPipelineRunAsync(runResponse.RunId);

            response.AssertSuccess();
        }
        public async Task TestGet()
        {
            PipelineClient    pipelineClient = CreatePipelineClient();
            PipelineRunClient runClient      = CreatePipelineRunClient();

            await using DisposablePipeline pipeline = await DisposablePipeline.Create(pipelineClient, this.Recording);

            CreateRunResponse runResponse = await pipelineClient.CreatePipelineRunAsync(pipeline.Name);

            Assert.NotNull(runResponse.RunId);

            PipelineRun run = await runClient.GetPipelineRunAsync(runResponse.RunId);

            Assert.AreEqual(run.RunId, runResponse.RunId);
            Assert.NotNull(run.Status);
        }