Fork me on GitHub
#onyx
<
2018-06-25
>
sparkofreason20:06:53

I have some tasks which take config data as an argument. That config data has changed, but when the job is resumed those tasks still use the old config values. Is there a way to update this sort of info when using resume points? Or should I be using a different method to obtain this config data so stale values aren't used when the job is resumed?

lucasbradstreet21:06:13

That’s odd, but it will completely depend on how you’re injecting the config data. Is it being placed into window state somehow? Otherwise I’m not sure how it could get the old values unless there was a mistake somewhere

sparkofreason22:06:13

I believe it is only injected as args on task functions. I'll double-check if it's leaking through anywhere else.

lucasbradstreet22:06:48

If that’s the case, I have no idea how it could happen as they are inject directly from the new job’s data at the time the peers start on the job

sparkofreason22:06:48

Are non-segment task arguments remembered at all? I've gotten errors when they were not serializable, but again perhaps that was because I let them get into some other portion of the state.

sparkofreason22:06:01

Hmmmm, I just found where I added that info to a window definition map as a hacky way of making it available to make it available to an emitter function. That's probably a bad practice.

lucasbradstreet22:06:28

yeah, that’s probably where it all went wrong. I prefer to just get at that data from the event map which is under :task-event in the state event map

lucasbradstreet22:06:39

assuming you only need it in the the windowing code

sparkofreason22:06:25

Not quite following there. I need some Datomic configuration data to be able to run a query in the emit function assigned to a window. Can that be made available in the job definition, or does it have to be passed through by some other mechanism?

lucasbradstreet22:06:35

Trigger emit gets passed the window map, trigger map, as well as the state event map http://www.onyxplatform.org/docs/cheat-sheet/latest/#trigger-entry/:trigger/emit

lucasbradstreet22:06:42

So you can put that datomic config data in either the window map, trigger map (each passed in), or you can stick it in the task map, which you can get from the state event map under :task-event :onyx.core/task-map http://www.onyxplatform.org/docs/cheat-sheet/latest/#state-event/:task-event

sparkofreason22:06:21

Thanks, put it in the task map, worked great. Hopefully that should ensure I get the latest config values on restart.