Melakukan langkah paralel dengan alur kerja sekunder secara inline
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mencakup kode sumber untuk alur kerja sekunder langsung dalam alur kerja utama agar lebih mudah dibaca.
Mempelajari lebih lanjut
Untuk dokumentasi mendetail yang menyertakan contoh kode ini, lihat artikel berikut:
Contoh kode
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],[],[],[],null,["# Perform a parallel step with the secondary workflow inlined\n\nIncludes the source code for a secondary workflow directly within the main workflow for easier readability.\n\nExplore further\n---------------\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Replace experimental function with parallel step](/workflows/docs/migrate-function-to-parallel)\n\nCode sample\n-----------\n\n### YAML\n\n main:\n params: [args]\n steps:\n - init:\n assign:\n - workflow_id: \"translate\"\n - texts_to_translate:\n - text: \"hello world!\"\n source: \"en\"\n target: \"fr\"\n - text: \"你好 世界!\"\n source: \"zh-CN\"\n target: \"en\"\n - text: \"No hablo español!\"\n source: \"es\"\n target: \"en\"\n - translated: [\"\", \"\", \"\"]\n - parallel_translate:\n parallel:\n shared: [translated] # to write to this variable, you must share it\n for:\n range: ${[0, len(texts_to_translate) - 1]}\n value: i\n steps:\n - basic_translate:\n call: googleapis.translate.v2.translations.translate\n args:\n body:\n q: ${args.text}\n target: ${args.target}\n format: \"text\"\n source: ${args.source}\n result: r\n - set_result:\n assign:\n - translated[i]: ${r}\n - return:\n return: ${translated}\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=workflows)."]]