Comments (8)
- Agreed, I think anything that returns Task other than the image downloads can be done this way.
- Correct that is the right pattern for Long Running Tasks, I would love to see that change!
from docker.dotnet.
This has been merged. Self assigning to cleanup Push/PullImageAsync in the v1.13 branch given the inclusion of JSONMessage etc.
from docker.dotnet.
Instead of returning Task<Stream>
we should return Task
. Then add a parameter to the function that takes IProgress<PullStatus> progress
. Each time that we receive the new "stream value" we deserialize it into the PullStatus
and then Report()
any waiter. The client looks like this:
var p = new Progress<Docker.DotNet.PullStatus>(status =>
{
// Do something with the status? Update a UI/PS/Service on the Sync Context of your choice.
});
await PullImageAsync(/*params*/, p);
PullStatus
is just a moniker. If Docker always does the same status struct then we can just use that instead for all methods that return a Task<Stream>
where <Stream>
contains only data that is just status. IE: docker logs is not a candidate here because the logs are an actual value.
from docker.dotnet.
I updated the tile which was very misleading. My response above is what we actually want. Not to change the return type to return progress but rather pass in an IProgress
of the appropriate type so we can handle the status reporting to waiters.
from docker.dotnet.
@jterry75 as mentioned on #143, Lets implement this issue.
I would like to align here the proper method signatures:
- For methods that are today returning
Task<Stream>
we should do as you mentioned here, correct? - For methods that are long running monitoring, like the ones on
MISC
endpoint, which endlessly monitor events on the engine/swarm, I would suggest return anIObservable<T>
where T is a structure with the general status update. That way, people don't need to await on that and instead can just subscribe. They can even use Rx to consume. As you may know,IObservable<T>
is available on .Net so we don't need add any dependencies... What do you think?
When I got answer for those two I'll submit the PR.
Thanks
from docker.dotnet.
Perfect! Will do it tonight when get home. Thanks @jterry75
from docker.dotnet.
I decided to not use IObservable<T>
because it will be too big breaking change on the public APIs.
I think IProgress<T>
is enough for that case. Specially that most of the time, the events are limited to an small number.
Please review when you can so I can move to the others. Thanks! Appreciate the support! :)
from docker.dotnet.
Thanks @jterry75 let me what else todo :)
from docker.dotnet.
Related Issues (20)
- MonitorEventsAsync syntax for --since param HOT 2
- Implement the Swarm Secrets 'Update a Secret'
- How to start an interactive session with StartContainerExecAsync? HOT 1
- Any plan for System.Text.Json? HOT 5
- /bin/bash: sudo test -f /repositories/gubbins/file.txt && echo true: No such file or directory
- [Question] equivalent api for docker service ps --no-trunc [swarm service name] HOT 2
- Not able to bind port to HostIp HOT 1
- What units are HealthConfig.StartPeriod in? HOT 1
- How to copy output from a container (E.g. output of an ML model) to the host machine
- Is there a way to manage stacks?
- README.md needs update because client.System.MonitorEventsAsync method is returning void not Stream.
- MonitorEventsAsync Progress Action is one event behind HOT 6
- Container does not receive stdin input
- .net8 build an image problem HOT 1
- BuildImageFromDockerFileAsync does not tag images correctly
- Container filters can't be negated HOT 6
- ServiceCreationMode is missing replicated-job and global-job
- Swarm.CreateServiceAsync doesn't return "Version" which means unable to do an UpdateServiceAsync afterwards
- .Net 8 upgrade: error occurred during the pre-login handshake
- Is this project alive? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker.dotnet.