Créer un job personnalisé avec le générateur de jobs
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Le générateur de jobs vous permet de créer des jobs Dataflow par lot et en flux continu personnalisés. Vous pouvez également enregistrer les jobs du générateur de jobs en tant que fichiers Apache Beam YAML pour les partager et les réutiliser.
Créer un pipeline
Pour créer un pipeline dans le générateur de tâches, procédez comme suit :
Accédez à la page Jobs de la console Google Cloud .
Ajoutez ensuite des sources, des transformations et des récepteurs au pipeline, comme décrit dans les sections suivantes.
Ajouter une source au pipeline
Un pipeline doit comporter au moins une source. Initialement, le générateur de tâches est renseigné avec une source vide. Pour configurer la source, procédez comme suit :
Dans le champ Nom de la source, saisissez un nom pour la source ou utilisez le nom par défaut. Le nom apparaît dans le graphique du job lorsque vous l'exécutez.
Dans la liste Type de source, sélectionnez le type de source de données.
En fonction du type de source, fournissez des informations de configuration supplémentaires.
Par exemple, si vous sélectionnez BigQuery, spécifiez la table à partir de laquelle lire les données.
Si vous sélectionnez Pub/Sub, spécifiez un schéma de message. Saisissez le nom et le type de données de chaque champ que vous souhaitez lire à partir des messages Pub/Sub. Le pipeline supprime tous les champs qui ne sont pas spécifiés dans le schéma.
Facultatif : Pour certains types de sources, vous pouvez cliquer sur Prévisualiser les données sources pour prévisualiser les données sources.
Pour ajouter une autre source au pipeline, cliquez sur Ajouter une source. Pour combiner des données provenant de plusieurs sources, ajoutez une transformation SQL ou Join à votre pipeline.
Ajouter une transformation au pipeline
Vous pouvez éventuellement ajouter une ou plusieurs transformations au pipeline. Vous pouvez utiliser les transformations suivantes pour manipuler, agréger ou joindre des données provenant de sources et d'autres transformations :
Type de transformation
Description
Informations sur la transformation YAML Beam
Filtrer (Python)
Filtrez les enregistrements avec une expression Python.
Utilisez n'importe quelle transformation du SDK Beam YAML.
Configuration de la transformation YAML : indiquez les paramètres de configuration de la transformation YAML sous la forme d'un mappage YAML. Les paires clé/valeur sont utilisées pour remplir la section de configuration de la transformation Beam YAML obtenue. Pour connaître les paramètres de configuration compatibles pour chaque type de transformation, consultez la documentation sur la transformation Beam YAML.
Exemples de paramètres de configuration :
Pour ajouter une transformation, procédez comme suit :
Cliquez sur Ajouter une transformation.
Dans le champ Transformation, saisissez un nom pour la transformation ou utilisez le nom par défaut. Le nom apparaît dans le graphique du job lorsque vous l'exécutez.
Dans la liste Type de transformation, sélectionnez le type de transformation.
En fonction du type de transformation, fournissez des informations de configuration supplémentaires. Par exemple, si vous sélectionnez Filtrer (Python), saisissez une expression Python à utiliser comme filtre.
Sélectionnez l'étape d'entrée de la transformation. L'étape d'entrée est la source ou la transformation dont la sortie fournit l'entrée pour cette transformation.
Ajouter un récepteur au pipeline
Un pipeline doit comporter au moins un récepteur. Initialement, le générateur de tâches est renseigné avec un récepteur vide. Pour configurer le récepteur, procédez comme suit :
Dans le champ Nom du récepteur, saisissez un nom pour le récepteur ou utilisez le nom par défaut.
Le nom apparaît dans le graphique du job lorsque vous l'exécutez.
Dans la liste Type de récepteur, sélectionnez le type de récepteur.
En fonction du type de récepteur, fournissez des informations de configuration supplémentaires.
Par exemple, si vous sélectionnez le récepteur BigQuery, sélectionnez la table BigQuery dans laquelle écrire.
Sélectionnez l'étape d'entrée du récepteur. L'étape d'entrée est la source ou la transformation dont la sortie fournit l'entrée pour cette transformation.
Pour ajouter un autre récepteur au pipeline, cliquez sur Ajouter un récepteur.
Exécuter le pipeline
Pour exécuter un pipeline à partir du générateur de tâches, procédez comme suit :
Facultatif : Définissez les options de la tâche Dataflow. Pour développer la section "Options du Dataflow", cliquez sur la flèche de développement arrow_right.
Cliquez sur Run Job (Exécuter la tâche). Le générateur de jobs accède au graphique de job pour le job envoyé. Vous pouvez utiliser le graphique de job pour surveiller l'état du job.
Valider le pipeline avant de le lancer
Pour les pipelines avec une configuration complexe, tels que les filtres Python et les expressions SQL, il peut être utile de vérifier la configuration du pipeline pour détecter les erreurs de syntaxe avant de le lancer. Pour valider la syntaxe du pipeline, procédez comme suit :
Cliquez sur Valider pour ouvrir Cloud Shell et démarrer le service de validation.
Cliquez sur Commencer la validation.
Si une erreur est détectée lors de la validation, un point d'exclamation rouge s'affiche.
Corrigez les erreurs détectées, puis validez les corrections en cliquant sur Valider. Si aucune erreur n'est détectée, une coche verte s'affiche.
Exécuter avec gcloud CLI
Vous pouvez également exécuter des pipelines Beam YAML à l'aide de la gcloud CLI. Pour exécuter un pipeline de job builder avec gcloud CLI :
Cliquez sur Enregistrer le fichier YAML pour ouvrir la fenêtre Enregistrer le fichier YAML.
Effectuez l'une des actions suivantes :
Pour enregistrer le fichier dans Cloud Storage, saisissez un chemin d'accès Cloud Storage, puis cliquez sur Enregistrer.
Pour télécharger un fichier local, cliquez sur Télécharger.
Exécutez la commande suivante dans votre interface système ou votre terminal :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/09 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/09 (UTC)."],[[["\u003cp\u003eThe job builder tool allows users to create custom batch and streaming Dataflow jobs directly in the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eUsers can define the pipeline by adding sources, transforms, and sinks, each with customizable settings depending on its type.\u003c/p\u003e\n"],["\u003cp\u003eThe tool provides features to validate pipeline configurations, run the pipeline, and monitor job progress via a job graph.\u003c/p\u003e\n"],["\u003cp\u003eJobs created with the builder can be saved as Apache Beam YAML files for sharing, reuse, and running with the gcloud CLI.\u003c/p\u003e\n"],["\u003cp\u003eTo run the pipeline, you must add at least one source and one sink, you can also add additional transforms to further manipulate the pipeline.\u003c/p\u003e\n"]]],[],null,["# Create a custom job with the job builder\n\nThe job builder lets you create custom batch and streaming Dataflow\njobs. You can also save job builder jobs as\n[Apache Beam YAML](https://beam.apache.org/documentation/sdks/yaml/)\nfiles to share and reuse.\n\nCreate a new pipeline\n---------------------\n\nTo create a new pipeline in the job builder, follow these steps:\n\n1. Go to the **Jobs** page in the Google Cloud console.\n\n [Go to Jobs](https://console.cloud.google.com/dataflow)\n2. Click add_box**Create job from\n builder**.\n\n3. For **Job name**, enter a name for the job.\n\n4. Select either **Batch** or **Streaming**.\n\n5. If you select **Streaming**, select a windowing mode. Then enter a\n specification for the window, as follows:\n\n - Fixed window: Enter a window size, in seconds.\n - Sliding window: Enter a window size and window period, in seconds.\n - Session window: Enter a session gap, in seconds.\n\n For more information about windowing, see\n [Windows and windowing functions](/dataflow/docs/concepts/streaming-pipelines#windows).\n\nNext, add sources, transforms, and sinks to the pipeline, as described in the\nfollowing sections.\n\n### Add a source to the pipeline\n\nA pipeline must have at least one source. Initially, the job builder is\npopulated with an empty source. To configure the source, perform the following\nsteps:\n\n1. In the **Source name** box, enter a name for the source or use the default\n name. The name appears in the job graph when you run the job.\n\n2. In the **Source type** list, select the type of data source.\n\n3. Depending on the source type, provide additional configuration information.\n For example, if you select BigQuery, specify the table to read\n from.\n\n If you select Pub/Sub, specify a message schema. Enter the name\n and data type of each field that you want to read from Pub/Sub\n messages. The pipeline drops any fields that aren't specified in the schema.\n4. Optional: For some source types, you can click **Preview source data** to\n preview the source data.\n\nTo add another source to the pipeline, click **Add a source** . To combine data\nfrom multiple sources, add a `SQL` or `Join` transform to your pipeline.\n\n### Add a transform to the pipeline\n\nOptionally, add one or more transforms to the pipeline. You can use the\nfollowing transforms to manipulate, aggregate, or join data from sources and\nother transforms:\n\nTo add a transform:\n\n1. Click **Add a transform**.\n\n2. In the **Transform** name box, enter a name for the transform or use the\n default name. The name appears in the job graph when you run the job.\n\n3. In the **Transform type** list, select the type of transform.\n\n4. Depending on the transform type, provide additional configuration\n information. For example, if you select **Filter (Python)**, enter a Python\n expression to use as the filter.\n\n5. Select the input step for the transform. The input step is the source or\n transform whose output provides the input for this transform.\n\n | **Note:** The `SQL` and `Join` transform can have multiple input steps.\n\n### Add a sink to the pipeline\n\nA pipeline must have at least one sink. Initially, the job builder is\npopulated with an empty sink. To configure the sink, perform the following\nsteps:\n\n1. In the **Sink name** box, enter a name for the sink or use the default name.\n The name appears in the job graph when you run the job.\n\n2. In the **Sink type** list, select the type of sink.\n\n3. Depending on the sink type, provide additional configuration information.\n For example, if you select the BigQuery sink, select the\n BigQuery table to write to.\n\n4. Select the input step for the sink. The input step is the source or transform\n whose output provides the input for this transform.\n\n5. To add another sink to the pipeline, click **Add a sink**.\n\nRun the pipeline\n----------------\n\nTo run a pipeline from the job builder, perform the following steps:\n\n1. Optional: Set Dataflow job options. To expand the\n Dataflow options section, click the\n arrow_rightexpander arrow.\n\n2. Click **Run job** . The job builder navigates to the\n [job graph](/dataflow/docs/guides/job-graph) for the submitted job. You can\n use the job graph to monitor the status of the job.\n\n| **Note:** You can load the pipeline's configuration back into the job builder by clicking the **Clone** button.\n\nValidate the pipeline before launching\n--------------------------------------\n\nFor pipelines with complex configuration, such as Python filters and SQL\nexpressions, it can be helpful to check the pipeline configuration for syntax errors before\nlaunching. To validate the pipeline syntax, perform the following steps:\n\n1. Click **Validate** to open Cloud Shell and start the validation service.\n2. Click **Start Validating**.\n3. If an error is found during validation, a red exclamation mark appears.\n4. Fix any detected errors and verify the fixes by clicking **Validate**. If no error is found, a green checkmark appears.\n\nRun with the gcloud CLI\n-----------------------\n\nYou can also run Beam YAML pipelines by using the gcloud CLI. To\nrun a job builder pipeline with the gcloud CLI:\n\n1. Click **Save YAML** to open the **Save YAML** window.\n\n2. Perform one of the following actions:\n\n - To save to Cloud Storage, enter a Cloud Storage path and click **Save**.\n - To download a local file, click **Download**.\n3. Run the following command in your shell or terminal:\n\n gcloud dataflow yaml run my-job-builder-job --yaml-pipeline-file=\u003cvar translate=\"no\"\u003eYAML_FILE_PATH\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eYAML_FILE_PATH\u003c/var\u003e with the path of your YAML file, either locally or in Cloud Storage.\n\nWhat's next\n-----------\n\n- [Use the Dataflow job monitoring interface](/dataflow/docs/guides/monitoring-overview).\n- [Save and load](/dataflow/docs/guides/job-builder-save-load-yaml) YAML job definitions in the job builder.\n- Learn more about [Beam YAML](https://beam.apache.org/documentation/sdks/yaml/)."]]