cadence | highly available orchestration engine to execute | Microservice library
kandi X-RAY | cadence Summary
kandi X-RAY | cadence Summary
This repo contains the source code of the Cadence server and other tooling including CLI, schema tools, bench and canary. You can implement your workflows with one of our client libraries. The Go and Java libraries are officially maintained by the Cadence team, while the Python and Ruby client libraries are developed by the community. See Maxim's talk at Data@Scale Conference for an architectural overview of Cadence.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cadence
cadence Key Features
cadence Examples and Code Snippets
Community Discussions
Trending Discussions on cadence
QUESTION
Can I get a list of all NFTs to an account on the Flow Blockchain? There is account storage and the documentation says
...Cadence represents each NFT as a resource object that users store in their accounts...
Or does the respective user has to have a dedicated collection in order to allow others to have a look at their NFTs?
...ANSWER
Answered 2022-Mar-24 at 06:20To obtain all NFTs under a user account, the following conditions are required:
- A collection needs to be created under the account to store NFT.
- The collection provides a public method to query its NFT list.
QUESTION
I would like to put workflow.Sleep
call in one of my Cadence activities to be able to test it properly (and simulate error result coming from Sleep
function).
Two important things which I noticed before implementing:
context.Context
andworkflow.Context
are separate types.- First parameter of each activity -
context.Context
- is optional and can be omitted
My tries:
1. First try
...ANSWER
Answered 2022-Mar-07 at 18:13Is it possible to use workflow.Sleep inside any activity?
No, it's NOT allowed to use workflow.Sleep
in activity code.
Workflow.Sleep
is only allowed in workflow code.
More general, all the APIs in workflow
package are ONLY allowed in workflow code.
The workflow code will be executed within decision task, and the workflow threads/coroutines(special kind of goroutines) are managed by Cadence. This is how those APIs in workflow
package works. Without decision tasks and workflow threads/coroutines, those API won't work properly.
The activity code on the other hand, is just purely normal code that you should use regular native library or dependency to implement the logic. For example, you can use time.Sleep
in activity code.
QUESTION
I am new to uber Cadence and trying to write a cron scheduled task. Cadence provided a cronSchedule annotation (find an example online) which takes a cron expression string for the method to be triggered at specific time. However, I want this cron expression to be loaded according to what we set in the yml file. Is there any way to do it? I currently only found this @cronSchedule annotation way to do it. I also found there is a WorkflowOption that I can set the cronSchedule. However, don't know how to use it to trigger the method. Below is the current code.
...ANSWER
Answered 2022-Jan-04 at 17:56In Temporal you can do it through WorkflowOptions:
QUESTION
`define NUM 100
program test;
function automatic int sum(int n);
if(n <= 1)
return n;
else
return n + sum(n-1);
endfunction
initial begin
$display("sum(%0d)=%d",`NUM, sum(`NUM));
end
endprogram
...ANSWER
Answered 2021-Dec-21 at 16:16The differences you are seeing are not due to the lifetime of the sum method—it's the order of evaluation of function calls within the expression n + sum(n-1)
, which is indeterminate. If you reverse the expression to sum(n-1) + n
, all tools give the correct result for a function with a static lifetime.
BTW, I strongly recommend that you never use program blocks in SystemVerilog. Use modules instead.
QUESTION
I would like to format my existing SQL queries inside the PySpark file.
This is how my existing source file looks like:
...ANSWER
Answered 2021-Dec-01 at 09:00One of the possible options is to use sql-formatter
.
Let's say we have a test.py
file:
QUESTION
I am evaluating cadence for implementing our business orchestration. I understand that the workers continuously poll the task list for tasks to execute. My concern here is that will it cause any scale problems? The worker is always busy and continuously polling some database, along with this it also needs to execute the business logic so is there a possibility that it runs out of resources and then crashes or drops the tasks to execute?
How does this polling mechanism scale when we have millions of workflows? Will it cause delays in executing the workflow code, when we have millions of tasks in the task list?
...ANSWER
Answered 2021-Nov-18 at 02:39Cadence and Temporal use long polling over gRPC to listen to task queues. So if there are no messages in the queues the poll requests return once per minute. This way workers don't consume excessive resources due to polling. Also, most poll calls never cause a call to the database due to various optimizations the matching service implements.
The number of open workflows doesn't affect polling performance at all as many of these workflows can be passively waiting on a timer on an external event. The number of operations per second that workflows execute defines how many tasks have to be delivered to workers. If the cluster and workers are provisioned correctly then even a high rate of tasks shouldn't cause any issues.
QUESTION
I am working on setting up my Android app to work with HTTP Web Links according to the various guides and protocols and have successfully setup the deeplinks which includes serving my assetlinks file from /.well-known/assetlinks.json
. Everything is working as expected. What I am struggling with from an operational perspective is how to go about maintaining this file -- specifically during update and failure scenarios.
Let's say I have existing customers who have downloaded my app and are using weblinks just fine. I update my assetlink file and push the new version to my server. When do my customers get the updated assetlink file? Is the OS configured to check for updates on some cadence or app launch? Is it only on app update or reinstall?
Similarly, imagine my website is down. New users are installing my app and the OS will not be able to associate my domain and when customers click the HTTP web links they will not be deeplinked into the app. This makes sense. But after I recover from my outage when will the customer get their assetlink file given the app is already installed?
Similarly lets say I upload an invalid assetlinks.json file. Will this break the current web links for existing customers who already had a valid association when they first installed the app?
Understanding these issues will ultimately help me better troubleshoot customer issues and tune the expected traffic I should expect to see for my assetlinks file from my server.
...ANSWER
Answered 2021-Nov-01 at 17:08Let me try to briefly put down how app linking works. I'm listing down all the things which I have learned gathered while playing with app links. Also attaching a very good article which covers in more details about the following.
There are two key components in registering and updating app links: Package manager
and Intent Filter Verifier
. These are the usual steps in which the workflow runs:
Every time an app is installed or updated through the package manager an intent named
INTENT_FILTER_NEEDS_VERIFICATION
is generated.The
Intent Filter Verifier
looks up the domains specified in the tags defined in the manifest of your app.For every domain/hostname specified for the app, the IntentFilterVerfier tries to fetch statements for each of the domain using an API call.
- A sample API call for the domain google.com looks like this
- The APIs documentation of this is carefully hidden by google at Digital Asset Links
Based on the result of the API call, the domain/hostname is categorized into one of the following buckets
QUESTION
In cadence a resource interface can contain state and methods that needs to be implemented. However when I try to indent a cadence file in vim it will indent the code wrong.
...ANSWER
Answered 2021-Oct-26 at 21:11Update: The maintainer has merged a request after we had a discussion that fixes a lot of my issues with this.
QUESTION
In current application, we have three services:
- invoice
- bank transfer : calls external API, which might takes a minute or so depends on queue
- ledger : internal microservice that create debit-credit ledger
To communicate, we have an orchestration saga. The flow is basically using invoice as the orchestrator:
- invoice service publish message to rabbitmq, asking payment for invoice X
- bank transfer service listen message, get invoice X
- bank transfer service process the transfer (calls bank's API). When payment success, publishing message to rabbitmq that 'Invoice X paid'
- invoice service listen the message 'Invoice X paid'
- Invoice service publish message 'Create ledger for invoice X' and publish to rabbitmq
- ledger service listen from rabbitmq for message 'Create ledger for invoice X'
- ledger service create appropriate ledger journal debit / credit, then publish 'ledger created for invoice X'
- Invoice service listen for message 'ledger created for invoice X', then finalize (close) the transaction
Question 1 If I'm using Temporal or cadence (just looking for it), they doesn't rely on pub-sub pattern like above. So how do I implement it?
I'm thinking (CMIIW) :
- create
InvoiceActivity
- create
BankTransferActivity
- create
LedgerActivity
- create
InvoicePaymentWorkflow
All of those Workflow
and Activity
are part of invoice service app. But instead of relying on pub-sub, the bank transfer service and ledger service now provides API to process transfer (in term of bank transfer, it acually a proxy API to external bank calll), and ledger service provides API to create debit/credit journal.
CMIIW, in this case, we no longer need creating listener (or cadence / temporal activity) on bank transfer service and ledger service, we need to provides API.
OR I'm thinking it wrong? There should be some activity on bank transfer service and ledger service? But if so, how can the invoice service trigger and arrange the workflow?
Question 2 But now the call is asynchronous. The journal ledger creation actually has some validation, and heavy load at times, so depends on message on queues, it can take up to 5 minutes from the message goes to rabbitmq until journal actually created. On API call, this will be a timeout.
Question 3 And what about the race condition? Some journals to be created in sequence. Using rabbitmq, we can achieve this with certain technique (single consumer on queue, something like kafka topic).
Question 4 Also, how to handle the compensating transaction? If ledger failed, we must do something. In our case, we must notify somebody on accounting, since bank transfer already processed and cannot reversed.
Question 5 For some subsidiariy companies, when ledger failed, we still has control, so we can compensate / withdraw the invoice amount, and return the amount back to parent company. Suppose we have a listener for this on the bank transfer service, how can we trigger the compensation API?
In cadence / Temporal, is this suitable usecase? If so, how to handle those issues above?
Thanks
...ANSWER
Answered 2021-Sep-21 at 19:58TLDR; This use case is the perfect fit for Temporal as it greatly simplifies your code and operations.
Question 1
I would recommend hosting activities in their correspondent services. So InvoiceActivity
should be hosted by the invoice service and BankTransferActivity
be hosted by the bank transfer service. This eliminates the need for creating synchronous APIs and ensures flow control between workflow and activity implementation. See this post that explains this in more detail.
The invoice service app would host the workflow code only in this case.
Question 2
Hosting activity in the corresponding service solves this issue. Temporal supports activities of unlimited duration. Note that heartbeating is recommended for long-running activities to ensure timely failure detection.
Question 3
The exact solution depends on the exact requirements. In the majority of cases, the journal entries that require specific sequencing should be orchestrated from a single workflow.
Question 4
Temporal by ensuring that the workflow code eventually completes makes it trivial to support compensating actions. Here is a SAGA example from Java SDK Samples repository.
Question 5
Just make this compensation logic part of the same workflow.
QUESTION
I'm trying to understand about case between same extended class in uvm as example below,
...ANSWER
Answered 2021-Sep-16 at 14:02you have the following scheme:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cadence
If server runs with Cassandra, Use Cadence Cassandra tool
If server runs with SQL database, Use Cadence SQL tool
The schema files are located at /usr/local/etc/cadence/schema/.
To upgrade, make sure you remove the old ElasticSearch schema first: mv /usr/local/etc/cadence/schema/elasticsearch /usr/local/etc/cadence/schema/elasticsearch.old && brew upgrade cadence-workflow. Otherwise ElasticSearch schemas may not be able to get updated.
Follow the instructions if you need to install older versions of schema tools via homebrew. However, easier way is to use new versions of schema tools with old versions of schemas. All you need is to check out the older version of schemas from this repo. Run git checkout v0.21.3 to get the v0.21.3 schemas in the schema folder.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page