dsl الحزمة

الوظائف

pipeline

إنشاء البنية الأساسية لبرنامج ربط العمليات التجارية التي تحتوي على جميع عقد المكون المحددة في هذه الدالة.

pipeline(func: Callable[[P], T] | None = None, *, name: str | None = None, version: str | None = None, display_name: str | None = None, description: str | None = None, experiment_name: str | None = None, tags: Dict[str, str] | None = None, **kwargs) -> Callable[[Callable[[P], T]], Callable[[P], PipelineJob]] | Callable[[P], PipelineJob]

المعلمات

func
FunctionType
القيمة الافتراضية: None

دالة مسار المستخدم المراد تزيينها.

name
str

اسم مكون البنية الأساسية لبرنامج ربط العمليات التجارية، يتم تعيينه افتراضيا إلى اسم الدالة.

version
str

إصدار مكون البنية الأساسية لبرنامج ربط العمليات التجارية، يتم تعيينه افتراضيا إلى "1".

display_name
str

اسم العرض لمكون البنية الأساسية لبرنامج ربط العمليات التجارية، يتم تعيينه افتراضيا إلى اسم الدالة.

description
str

وصف البنية الأساسية لبرنامج ربط العمليات التجارية المضمنة.

experiment_name
str

اسم التجربة التي سيتم إنشاء الوظيفة ضمنها، إذا تم توفير None، فسيتم تعيين التجربة إلى الدليل الحالي.

tags
dict[str, str]

علامات مكون البنية الأساسية لبرنامج ربط العمليات التجارية.

kwargs
dict

قاموس معلمات تكوين إضافية.

المرتجعات

إما

  • مصمم الديكور، إذا كان func هو None
  • func المزين

نوع الإرجاع

أمثلة

يوضح كيفية إنشاء مسار باستخدام هذا المصمم.


   from azure.ai.ml import load_component
   from azure.ai.ml.dsl import pipeline

   component_func = load_component(
       source="./sdk/ml/azure-ai-ml/tests/test_configs/components/helloworld_component.yml"
   )

   # Define a pipeline with decorator
   @pipeline(name="sample_pipeline", description="pipeline description")
   def sample_pipeline_func(pipeline_input1, pipeline_input2):
       # component1 and component2 will be added into the current pipeline
       component1 = component_func(component_in_number=pipeline_input1, component_in_path=uri_file_input)
       component2 = component_func(component_in_number=pipeline_input2, component_in_path=uri_file_input)
       # A decorated pipeline function needs to return outputs.
       # In this case, the pipeline has two outputs: component1's output1 and component2's output1,
       # and let's rename them to 'pipeline_output1' and 'pipeline_output2'
       return {
           "pipeline_output1": component1.outputs.component_out_path,
           "pipeline_output2": component2.outputs.component_out_path,
       }

   # E.g.: This call returns a pipeline job with nodes=[component1, component2],
   pipeline_job = sample_pipeline_func(
       pipeline_input1=1.0,
       pipeline_input2=2.0,
   )
   ml_client.jobs.create_or_update(pipeline_job, experiment_name="pipeline_samples", compute="cpu-cluster")