我有一個用C#編寫的.exe
(控制檯應用程序)文件,我想用Azure Data Factory運行該文件。在Azure Data Factory中運行.NET .exe
我需要做什麼才能做到這一點?
我知道對於.dll
文件,我們可以選擇在azure中運行它們,但.exe
文件又如何?
我有一個用C#編寫的.exe
(控制檯應用程序)文件,我想用Azure Data Factory運行該文件。在Azure Data Factory中運行.NET .exe
我需要做什麼才能做到這一點?
我知道對於.dll
文件,我們可以選擇在azure中運行它們,但.exe
文件又如何?
你不能。不要試圖把一個方形的釘子放在圓孔裏。它將不得不被包裝爲ADF定製活動。
您需要從ADF基類繼承並調用IDictionary的execute方法。
例如:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure;
using Microsoft.Azure.Management.DataFactories.Models;
using Microsoft.Azure.Management.DataFactories.Runtime;
namespace ClassLibrary1
{
public class Class1 : IDotNetActivity
{
public IDictionary string, string Execute(
IEnumerable linkedServices,
IEnumerable datasets,
Activity activity,
IActivityLogger logger)
{
logger.Write("Start");
//Get extended properties
DotNetActivity dotNetActivityPipeline = (DotNetActivity)activity.TypeProperties;
string sliceStartString = dotNetActivityPipeline.ExtendedProperties["SliceStart"];
//Get linked service details
Dataset inputDataset = datasets.Single(dataset = dataset.Name == activity.Inputs.Single().Name);
Dataset outputDataset = datasets.Single(dataset = dataset.Name == activity.Outputs.Single().Name);
/*
DO STUFF
*/
logger.Write("End");
return new Dictionary string, string();
}
}
}
來源:https://www.purplefrogsystems.com/paul/2016/11/creating-azure-data-factory-custom-activities/
您在控制檯應用程序擁有的任何方法,只是它們改寫爲可通過Azure的批量服務的計算池來實例化一個類,這是在ADF通過了編譯。
這是ADF如何做到的。
希望這會有所幫助。
正如Paul Andrew指出的那樣,您需要使用定製活動SPI,如https://docs.microsoft.com/en-us/azure/data-factory/data-factory-use-custom-activities所述。你有三個選擇:
有趣的是,由於@Alexandre –
感謝重播, – user3843858
感謝重播,https://docs.microsoft.com/en -us/azure/data-factory/data-factory-use-custom-activities現在正在工作,當我將我的多維數據集處理代碼與以下消息一起失敗時,模塊中出現未知錯誤:System.Reflection.TargetInvocationException:拋出異常調用的目標。 ---> Microsoft.AnalysisServices.ConnectionException:連接字符串無效。 ---> System.FormatException:輸入字符串的格式不正確。在System.Number.StringToNumber(String str,NumberStyles選項 – user3843858
感謝重播我hinsight執行這個規定,但是它的faill – user3843858