Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow for Zebra #163

Open
evaachim opened this issue Feb 7, 2023 · 26 comments
Open

Workflow for Zebra #163

evaachim opened this issue Feb 7, 2023 · 26 comments
Assignees
Labels
advancement Additions enhancement New feature or request info

Comments

@evaachim
Copy link
Contributor

evaachim commented Feb 7, 2023

Ideas for implementing a temporal workflow for Zebra.

@evaachim evaachim changed the title More Temporal More Workflow Feb 7, 2023
@evaachim evaachim changed the title More Workflow Workflow for Zebra Feb 13, 2023
@evaachim
Copy link
Contributor Author

evaachim commented Feb 13, 2023

Temporal can begin once one of the criteria is met.

  • a login occurs

Can check if a given user exists to verify

  • a request comes in

Can check the status to verify

  • a notification is needed

Based on status / requests

@evaachim
Copy link
Contributor Author

Preferably, both a synchronous and an asynchronous execution will be used.

@evaachim
Copy link
Contributor Author

evaachim commented Feb 13, 2023

workflow -->
is the criteria met?
--> Yes -->
which one? --> resource requested --> execute activity
--> login occurs --> execute activity

--> No --> don't execute activity

@evaachim
Copy link
Contributor Author

evaachim commented Feb 13, 2023

func Workflow(ctx workflow.Context, resource zebra.Resource, store Zebra.Store) (string, error){

options := workflow.ActivityOptions{
	// some options.
}

execute ActivityLoggedIn
executeActivityRequested

}

func ActivityRequested(ctx context.Context, store zebra.Store, email string) (string, error) {
if requested{
execute RequestedActivitiesInWorkflow
}
}

func ActivityLoggedIn(ctx context.Context, store zebra.Store, email string) (string, error) {
if userLoggedIn{
execute LoginActivitiesInWorkflow
}
}

@evaachim
Copy link
Contributor Author

Things to consider:

  • What worker options should be added?
  • Less criteria for triggering temporal and more grouping or more criteria and less grouping?
  • How will sync vs async be set up?

@evaachim
Copy link
Contributor Author

evaachim commented Feb 14, 2023

Worker options to consider:

EnableSessionWorker

DeadlockDetectionTimeout

@evaachim
Copy link
Contributor Author

evaachim commented Feb 15, 2023

ActivityOptions not necessarily needed

ClientOptions may be needed

@evaachim
Copy link
Contributor Author

evaachim commented Feb 15, 2023

To consider making async :

  1. Send notifications

To consider including in parallel exec logic:

  1. Staying Logged in
  2. Requests coming in

@evaachim
Copy link
Contributor Author

Will only use for async situations

@evaachim
Copy link
Contributor Author

For notification temporal, notification code is needed and may be divided into multiple parts.

@evaachim
Copy link
Contributor Author

Use temporal with wrapper functions that contain the Zebra logic.

@evaachim
Copy link
Contributor Author

ActivityOptions not necessarily needed

ClientOptions may be needed

Need a time parameter, to timeout

@evaachim
Copy link
Contributor Author

evaachim commented Feb 17, 2023

Currently using StartToCloseTimeout for the time parameter

@evaachim
Copy link
Contributor Author

evaachim commented Feb 17, 2023

May want to consider adding an additional verification step to distinguish between activities that get triggered, especially when an activity can be subdivided into multiple activities.

@evaachim
Copy link
Contributor Author

Options for including API on top of temporal

@evaachim
Copy link
Contributor Author

May consider including a lock/mutex to protect critical sections.

@evaachim
Copy link
Contributor Author

There can be an interface for all temporal-related functions.

@evaachim evaachim added enhancement New feature or request advancement Additions labels Feb 22, 2023
@evaachim
Copy link
Contributor Author

Temporal should use abstraction

@evaachim evaachim added the info label Feb 22, 2023
@evaachim
Copy link
Contributor Author

Set up black-box style logic

@evaachim
Copy link
Contributor Author

The abstraction can have an initial condition and an exit condition.

@evaachim
Copy link
Contributor Author

Other things that should exist in the abstraction:

  • internal conditions
  • options
  • potential variable durability for actions

@evaachim
Copy link
Contributor Author

The initial condition can be one / many. Currently, it is more granular.

@evaachim evaachim added this to zebra Feb 23, 2023
@evaachim
Copy link
Contributor Author

If there is ONE initial condition, it could possibly be the log in. If there are more, each can work as independent conditions.

@evaachim
Copy link
Contributor Author

Think: How will the exit condition be determined ?

@evaachim
Copy link
Contributor Author

evaachim commented Feb 23, 2023

Some ideas:

  • Will there be one initial condition for the workflow?
  • Alternatively from above, will there be multiple initial conditions that initiate temporal as a series of interconnected workflows?
  • Will there be a single, defined, exit condition?
  • Alternatively from above, will there be multiple cases when temporal exits?
  • Will there be a single, big workflow?
  • Alternatively from above, will there be multiple workflows, with connective conditions?
  • Will temporal execute indefinitely
  • Alternatively from above, will temporal execute only in certain cases?

@evaachim
Copy link
Contributor Author

Ideas to consider:

  • Will there be a single initiation / exit condition ?

  • Alternatively from above, will there be multiple such conditions ?

  • Will there be a single workflow with multiple subworkflows / workers?

  • Alternatively from above, will there be multiple workflows with connective conditions?

  • Will temporal run indefinitely

  • Alternatively from above, will temporal only start at certain times?

  • How will the exit condition be determined

@evaachim evaachim self-assigned this Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advancement Additions enhancement New feature or request info
Projects
Status: No status
Development

No branches or pull requests

1 participant