qri-io / qri

you're invited to a data party!
https://qri.io
GNU General Public License v3.0
1.11k stars 66 forks source link

refactor(transform): add `transform.Mode` enum to track "apply" modes #1902

Closed ramfox closed 3 years ago

ramfox commented 3 years ago

We can use the Mode field in the event.TransformLifecycle, event.TransformStepLifecyle, and event.TransformMessage to track whether or not a transform is an "apply" run, or a run whose output is not saved, or a "commit" run, or a run whose output is saved as a new dataset version.

We can use these events to track "RunCount" on a dataset in the collection.


Added Mode to TransformLifecycle, TransformStepLifecycle, and TransformMessage

Event Types that have a Mode field in the payload: ETTransformStart = Type("tf:Start") ETTransformStop = Type("tf:Stop") ETTransformStepStart = Type("tf:StepStart") ETTransformStepStop = Type("tf:StepStop") ETTransformStepSkip = Type("tf:StepSkip") ETTransformError = Type("tf:Error")

Event Types that do NOT have a Mode field in the payload:

ETTransformPrint = Type("tf:Print") This event is only called via the print starlark command, not sure we need to be adding a "mode" to this, as I believe it's handled differently than other events in the frontend.

ETTransformDatasetPreview = Type("tf:DatasetPreview") This event has an event of type dataset.Dataset, and so we would need to add a new transform event to incorporate a Mode field into this event payload. However, I believe that it, too, is treated differently than other events in the frontend, and so we may not need to add a "mode" to this as well.