Data Hub

Configure run detection and uploads

Choose how the watcher groups files into runs, when files are ready to upload, and whether uploads are automatic or approved.

ForLab operators

Three settings decide which files become a run and when they leave the instrument PC: run detection, the stability period, and the upload mode. This page explains how to choose them. Watcher configuration lists every field and its allowed values.

Admins can change these on the Settings tab of the instrument’s watcher page; see Change a watcher’s settings. On the PC, set them during data-hub-watcher init, with data-hub-watcher config edit, or by editing ~/.data-hub/config.yaml and restarting the watcher.

Group files into runs

A run is the files from one acquisition, which the watcher reports together. Run detection gives each file a run ID, worked out from the file’s path inside the watch folder. The two common choices are these:

  • Prefix from the file name: a pattern (a regular expression) picks out part of the name, for example everything before the first underscore, so RUN001_data.csv → RUN001
  • One folder per run: each folder inside the watch folder is its own run, so RUN001/data.csv → RUN001

Run detection lists every preset and how to write your own pattern. Set recursive: true when files are in subfolders; otherwise the watcher watches only the top level of the watch folder.

When a run gathers files from several folders, two files can share a name, such as a run.json in each capture folder. The watcher keeps every copy and adds a short tag to the later names, such as sample~3f9a1c2b.tif.

If files appear on disk but never become runs, check for pattern_mismatch events on the watcher’s Activity tab and run data-hub-watcher watch --dry-run.

Wait until writes finish

The stability period is how many seconds a file must keep the same size and modification time before the watcher treats it as fully written. The default is 5 seconds, and it can be 1 to 300. Raise it for instruments that write large files slowly.

The watcher gives up on a file that keeps changing for longer than max_stability_wait_seconds, 300 seconds by default, and records a stability_timeout error event. Raise that limit for instruments whose writes take longer. It must be at least the stability period.

A file that the instrument keeps open after its last write can look finished while the watcher still can’t read it. The watcher tries the file again every minute until it can read it, then uploads it, and a request made with Upload stays requested in the meantime. The watcher’s Activity tab shows a File not ready event for each such file, and another each time the watcher starts or its settings change.

Watchers before 1.4.2 try such a file again only at their next start, and cancel a request for it after three tries.

Choose auto or manual upload

ModeBehavior
autoUpload each file as soon as it’s found and stable. The watcher also uploads files someone requests with Upload on the run page, and retries uploads that a restart cut off.
manualReport the run, but upload a file only after someone requests it. The watcher checks for requests once a minute.

Use manual mode when someone must approve which files leave the instrument PC. Anyone signed in can approve files from the run page. An instrument in manual mode shows a note beside its file patterns saying files upload when someone requests them; see Approve or delete files.

Existing files on first setup

initial_scan decides what happens to files already in the watch folder the first time the watcher connects to an environment:

  • production: uploads them (full) by default
  • staging and preview: record them and skip them (new-only) by default

Set initial_scan in the config when you need the other behavior; see Initial scan.

On this page