Add the ability to require multiple data stream writers of the same type on a task driver job.
The API proposed here provides a solution until a proper solution can be devised during #224
This solution takes advantage of the fact that all data stream pending collections share the same access handle this means that, from a job dependency perspective, getting write access to a stream instance also provides write access to all other stream instances of the same type (shared/wide writing).
What is the current behaviour?
Developers are unable to include writers to multiple data streams of the same type in their job. This most commonly comes up when there are cancel requests to multiple task drivers that a job may want to make during execution.
What is the new behaviour?
Developers can now include multiple data streams of the same type in their job.
Require the two stream instances in your job configuration as you normally would
When calling jobData.Fulfill() provide the specific stream instance after the out parameter.
How it works
On the first write request we create an access wrapper as we normally would.
For all other write requests after the first one we keep the same access wrapper and track the specific instance request for safety checks. (only if ANVIL_DEBUG_SAFETY is enabled)
During fulfill we use the provided stream instance to generate a writer and make a safety check to ensure that instance was required during job config.
Edge Case Behaviour (WhenANVIL_DEBUG_SAFETY is enabled)
Including the explicit stream in Fulfill() when only one instance of the stream type has been requested emits a warning. The default Fulfill() without the explicit stream should be preferred when possible.
Forgetting to include the explicit stream when multiple instances have been requested will throw an error. There is no default resolution when multiple instances have been required.
Add the ability to require multiple data stream writers of the same type on a task driver job. The API proposed here provides a solution until a proper solution can be devised during #224
This solution takes advantage of the fact that all data stream pending collections share the same access handle this means that, from a job dependency perspective, getting write access to a stream instance also provides write access to all other stream instances of the same type (shared/wide writing).
What is the current behaviour?
Developers are unable to include writers to multiple data streams of the same type in their job. This most commonly comes up when there are cancel requests to multiple task drivers that a job may want to make during execution.
What is the new behaviour?
Developers can now include multiple data streams of the same type in their job.
jobData.Fulfill()
provide the specific stream instance after theout
parameter.How it works
On the first write request we create an access wrapper as we normally would. For all other write requests after the first one we keep the same access wrapper and track the specific instance request for safety checks. (only if
ANVIL_DEBUG_SAFETY
is enabled)During fulfill we use the provided stream instance to generate a writer and make a safety check to ensure that instance was required during job config.
Edge Case Behaviour (When
ANVIL_DEBUG_SAFETY
is enabled)Fulfill()
when only one instance of the stream type has been requested emits a warning. The defaultFulfill()
without the explicit stream should be preferred when possible.What issues does this resolve?
Resolve: #245
What PRs does this depend on?
Does this introduce a breaking change?