Skip to main content

Pipelines

A pipeline is the queue of items an Unstract Flow workflow works through from one source: threads in an inbox, files in a folder or bucket, or rows in a database table. Each run claims the next item, so two runs of the same workflow never process the same one, even when a deployment starts several runs at once. Each workflow keeps its own pipeline, so two workflows reading the same inbox, folder or table each process every item.

The email connectors (Gmail, Outlook, and IMAP/SMTP), the file connectors (Amazon S3, Google Drive, SharePoint, SFTP) and the Database connector each keep a pipeline per instance.

How a run works through a pipeline​

The spec asks for the next item, for example "Take the next unread thread from @email_gmail". The run claims that item, reads it, and works on it.

  • A file or a table row is marked Success or Failed when the run finishes with it.
  • An email thread moves to Staged once the run has read it, and is marked Success or Failed when the run finishes with it. When a new message from someone else arrives on a thread marked Success, the next run that refreshes the inbox marks it Update Pending, with a clock icon, and claims it again. The workflow's own replies don't count: a message from the mailbox's own address never queues a thread again.

An item stays claimed while its run holds it. When a claim is more than eight hours old and its run has ended, a check that runs every five minutes marks the item Failed. An email thread the run read and left Staged is marked Failed too when that run ended Failed or Cancelled; after a run that ended Succeeded or Partial, it stays Staged.

Item states​

The editor shows a tab for each pipeline, grouped under External File Systems, Email and Database.

TabStates
FilesAvailable, In Progress, Success, Failed, Source Unavailable, Unreadable
EmailAvailable, Claimed, Staged, Success, Failed, Source Unavailable, Unreadable
DatabaseAvailable, In Progress, Success, Failed

Available items are waiting for a run. A file whose fetch fails stays In Progress, and the run gets the error. A file or a table row is In Progress while a run holds it. An email thread is Claimed while a run holds it, then Staged once the run has read it. When the mail service is busy or unavailable as the run reads a thread, the thread goes back to Available for a retry or the next run. The thread waits 5 minutes before a run claims it again, and its tab shows Waiting to retry next to its status. A read that fails again within those 5 minutes isn't counted, and the third counted failure in a row marks it Failed. Reset Status and Reset All end the wait and clear the count. A file or a thread is Source Unavailable when it was deleted from its source before the run read it. A file or a thread is Unreadable when Flow can't read its pipeline record; the tab shows its ID and nothing else. Select it and select Remove, and the next run that finds it in its source adds it back as Available.

The Pipeline progress panel on the workflow's runs page counts each pipeline's items by status. Database counts are current. Email and file items are counted in the background about once a minute, with the time of the count shown, and a pipeline of more than 1,000 items is counted on the 1,000 that changed most recently.

Items that disappear​

When a file or a thread is deleted from its source after a run claims it and before the run reads it, the connector reports it as missing and marks it Source Unavailable. The run skips that item and goes on to the next one. Say in the spec if you want something else, such as a notice.

Reprocess and prioritize​

  • Reset Status puts an item back to Available, and the next run processes it again. Reset All does that for every item in the pipeline; on a files tab it resets every file pipeline in the workflow.
  • An item that is In Progress, Claimed or Staged for a run that is still going shows In use next to its status. Such a run is Queued, Running, Resuming, Needs review or Waiting for quota. Reset Status and Remove are off while the selection includes such an item, and Flow refuses them with a message that names the run. Reset All skips such items and says how many it skipped. It also skips an email thread or a file that a run is claiming or marking at that moment, and says how many were busy; select Reset All again for those. Once the run ends, or you cancel it, the item can be reset; after a cancel, wait for the run's last step first, as the caution below says. A run that stopped making progress is failed after 30 minutes.
  • On a files tab, Expedite moves a file to the front of the queue, and Clear Expedite puts it back in order.
  • On a files tab, Reset All resets every file pipeline in the workflow. The API's reset-all resets only the connector instance it names; Pipeline items lists the requests.
  • Release claims, in the details of a run that ended Partial, Failed or Cancelled, and of some older runs that ended Succeeded, returns the items that run still held to Available: table rows, files, and inbox threads it claimed but hadn't read. Also release items this run already read or finished returns the threads it read, which are Staged, and the items it marked Success; the run may already have replied to those or written them. An item another run has claimed since is left alone. A released thread keeps its count of failed reads.
Limitations
  • After you cancel a run, its items no longer show In use, but the step it was on can keep going until it finishes or reaches its time limit: 3 minutes for most steps, 16 minutes for a website or terminal session, and up to the instance's Max Polling Time for an Unstract or LLMWhisperer step. Wait that long before you reset, remove or release an item the run held, or that step may still reply to it or write it.