# להריץ תהליך אחר ולחכות לו

> מפעיל תהליך אחר של סביבת העבודה על אותם מסמכים וממתין עד שהוא מסיים. אחר כך אפשר להמשיך לפי מה שעשה, כמו הסטטוס שלו או השדות שמצא. לתהליך השני יש הגדרות, חיבורים ועלות משלו.

Source: https://docs.go-lumen.ai/he/reference/steps/run-flow

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `run-flow` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | control, logic |
| **קרדיטים** | **0** קרדיטים בכל פעם שהוא מצליח |
| **השפעה חיצונית** | כן: הוא משנה משהו מחוץ ל-Lumen, ולכן ניסיון חוזר שואל קודם, ובדיקה מראה מה הוא היה עושה במקום לעשות את זה. |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | כלום |
| **מפיק** | `fields` |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

צומת מאוחר יותר מפנה לפלט כ-`{nodeId.field}` בטקסט, או כ-`nodeId.field` בתנאי.

| פלט | סוג |
| --- | --- |
| `childRun` | string |
| `flow` | string |
| `status` | string |
| `outcome` | string |
| `error` | string |
| `timedOut` | boolean |
| `output` | object |

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `flow` (חובה) | string |  | One of this workspace's flows that starts with 'Another flow starts it'. The step starts it on the same documents and waits for it to finish. (minLength 1; maxLength 253) |
| `timeoutHours` | integer | `168` | TimeoutHours is how long to wait for the child; unset is 168 (7 days). (minimum 1; maximum 720) |
| `onTimeout` | string | `"fail"` | OnTimeout is what the step does when the child is not done in time. (one of fail, continue) |
| `onFailure` | string | `"fail"` | OnFailure is what the step does when the child fails. (one of fail, continue) |

ה-JSON Schema המלא של ההגדרות: [run-flow.schema.json](https://docs.go-lumen.ai/schemas/steps/run-flow.schema.json).

## דוגמה

```yaml title="config"
flow: price-list-update
timeoutHours: 72
```

## שימוש בתהליך

צומת שמריץ את `run-flow` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

```yaml title="flow.yaml (spec.nodes)"
- id: run-flow
  stepRef: {name: run-flow}
  config:
    flow: price-list-update
    timeoutHours: 72
```
