Skip to content

Conversation

@krisbitney
Copy link
Contributor

This PR adds a standard interface for concurrency. This builds on the Concurrent interface written by @Niraj-Kamdar . The interface was updated by referencing similar interfaces in various programming languages.

Please carefully review this interface and provide feedback!

Note: I am proposing that we change the name of the interface from Concurrent to Concurrency.

Details regarding references to features in other interfaces can be found in the issue comments: https://github.com/polywrap/std/issues/9#issuecomment-1548301252

Closes https://github.com/polywrap/std/issues/9

Copy link

@Niraj-Kamdar Niraj-Kamdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but some of the options and methods may not be supported by all concurrency primitives
Ex: Promise do not support abort. Atleast not in the sense use expects
Similarly pausing and resuming may also be more complex and hard to achieve

We need to make sure we can effortlessly support these options and if not we can easily convey it to users.

I know I was the one who introduced some of these concepts but I think we need to revisit it

"""
The priority level of the task. This helps determine the order in which the task will be executed. Defaults to Priority.MEDIUM if not specified.
"""
priority: Priority

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we enforce this? What are some use cases of this?

"""
The maximum number of workers that should be used to execute this task. If not specified, the system will determine the optimal number of workers.
"""
max_workers: Int

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be beneficial to have max_workers available both as an argument and within the environment variables instead of either one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants