Share via


dsl Paket

İşlevler

pipeline

Bu işlevde tanımlanan tüm bileşen düğümlerini içeren bir işlem hattı oluşturun.

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]

Parametreler

func
FunctionType
varsayılan değer: None

Donatılacak kullanıcı işlem hattı işlevi.

name
str

İşlem hattı bileşeninin adı, varsayılan olarak işlev adıdır.

version
str

İşlem hattı bileşeninin sürümü varsayılan olarak "1" olur.

display_name
str

İşlem hattı bileşeninin görünen adı, varsayılan olarak işlev adıdır.

description
str

Oluşturulan işlem hattının açıklaması.

experiment_name
str

İşin altında oluşturulacağı denemenin adı, Hiçbiri sağlanmazsa deneme geçerli dizin olarak ayarlanır.

tags
dict[str, str]

İşlem hattı bileşeninin etiketleri.

kwargs
dict

Ek yapılandırma parametreleri sözlüğü.

Döndürülenler

Herhangi biri

  • Bir dekoratör, func Yok ise
  • Dekore edilmiş func

Dönüş türü

Örnekler

Bu dekoratörü kullanarak işlem hattı oluşturmayı gösterir.


   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")