External Storage Integration: NexusWorker - #3018
Conversation
460bfbf to
b3804da
Compare
609161f to
c553b3d
Compare
b3804da to
ca09b50
Compare
e8155ee to
5ef0bd6
Compare
|
Missing: NexusClient integration. Adding now. |
41fa991 to
94eaaca
Compare
| task.getCompletionCallback()); | ||
| } | ||
|
|
||
| private void storeOutbound(Message.Builder builder) { |
There was a problem hiding this comment.
Why does this storeOutbound work differently then this one ? Should we just make one common helper ?
There was a problem hiding this comment.
Some callers of storeOutbound have already built messages and some have builders. Some also need a target (ActivityWorker) and others also need a visitor (the WorkflowWorker one). We could create a MessageOrBuilder type for this (maybe there already is one) and do some refactoring. Personally, I'd like that to be a follow-up if that is the direction we want to head in.
|
Is there any tests showing external storage working for a Nexus operation? or what PR would that be in? |
|
Codex flagged these issues as well |
2d2d90e to
504467c
Compare
94eaaca to
78778d3
Compare
78778d3 to
d877ec7
Compare
|
The codex finds are interesting. I think it's correct, it doesn't look like the we are catching failures. Adding some logic to send a nexus task failed so the server can retry instead of waiting for timeout. |
|
Addressed the feedback and issues codex found. One thing to note @Quinn-With-Two-Ns is that when we fail the nexus task (because of an external storage issue which happens AFTER the task is handled + "complete") and respond with a Another interesting idea @jmaeagle99 is that we could have a fallback for scenarios like this where we would skip external storage since the nexus task already completed for scenarios where making an idempotent task is more of a detriment than just skipping external storage... so external storage would be configured with a "do your best to offload these payloads but if you cant (because the provider is down, etc) its ok to send them through as regular payloads". |
|
Also added some tests @Quinn-With-Two-Ns to address your feedback. |
I don't think this is a new error mode for Nexus Operation handlers though. They already have at-least-once attempt semantics. The operation's work needs to be idempotent regardless of external storage. On skipping external storage, if the result is too large, then the task should be failed by the server (have to double check that) in a terminal way. Even if it doesn't, it will likely poison downstream consumers. |
| .inc(1); | ||
| HandlerException handlerException = | ||
| new HandlerException(HandlerException.ErrorType.INTERNAL, "External storage failed", e); | ||
| sendReply( |
There was a problem hiding this comment.
I think this needs to handle ExternalStorageTaskFailure in case the failure cannot be externally stored and then submit a minimal NexusTaskHandler.Result from a small exception instance.
| task = retrieveInboundPayloads(task); | ||
| } catch (Throwable e) { | ||
| taskFailed = true; | ||
| sendStorageFailure( |
There was a problem hiding this comment.
This is going to log "External storage failed for a nexus task" but external storage is not configured, so the log is misleading.
| ExternalStorage externalStorageConfig = options.getExternalStorage(); | ||
| if (externalStorageConfig != null) { | ||
| options = | ||
| NexusClientOptions.newBuilder(options) |
There was a problem hiding this comment.
Should this setExternalStorage(null)?
| } | ||
|
|
||
| @Nullable | ||
| public ExternalStorage getExternalStorage() { |
| return this; | ||
| } | ||
|
|
||
| public NexusClientOptions.Builder setExternalStorage( |
| public void interruptingShutdownCancelsInFlightStorage() throws Exception { | ||
| NexusWorker worker = worker(); | ||
|
|
||
| worker.shutdown(new ShutdownManager(), true).get(); |
There was a problem hiding this comment.
These should be closed, probably in a finally, in every test.
| slotSupplier.markSlotUsed( | ||
| new NexusSlotInfo( | ||
| service, operation, taskQueue, options.getIdentity(), options.getBuildId()), | ||
| task.getPermit()); |
There was a problem hiding this comment.
This code and above used to be outside of the try block. Not sure it needs to be inside. It might incidentally fix some existing problems. But its not the focus of this PR. If it doesn't need to be in the try to enable external storage, then let's move it back. If it is fixing something separately, then open a different PR for it.
What was changed
NexusWorkernow stores and retrieves payloads.Why?
Checklist