Running backdated transaction in Corda - corda

I have a scheduled state, which invokes scheduled activity. As per states generated and logs, we found scheduler activity stops because of breaking errors and now new state has been created after it. Is it possible to run the scheduler back from the day it stopped. Is it possible to run a flow on a backdate in Corda, given we have access to all the nodes and network.

It's not possible to run the scheduler in a backdated way, e.g. by changing the system clock.
To understand why we need to understand how the scheduler in Corda works.
The scheduling system doesn't loop over the system time to work out when it should run, but instead kicks off the activity once a particular time has elapsed, e.g. if you scheduled the task to run tomorrow at 13:00 at 12:00 today, a timer for 25 hours would be kicked off.
Once that scheduled activity has run, a new timer is calculated and kicked off.
If the node goes down, as soon as it comes back up, it'll work out if any scheduled tasks have been missed and if so, run them immediately. Any future dated scheduled tasks have their timers recalculated.
The best advice would be to run those errored tasks manually.

Related

Does it makes sense to pause a DAG that has Schedule set to None?

I'm new to Airflow and have a hard time to figure for what Pause a DAG is used for.
If our dags are set only for manual trigger does it makes sense to pause these kind of DAGs?
Certainly! Airflow DAGs that are configured with a schedule_interval of None could be executed by manual intervention through the UI, getting triggered by another DAG via the TriggerDagRunOperator, or even through an API call. If any of these actions happen, you could prevent the DAG from running by pausing it.
Another situation for pausing DAGs could be if a DAG fails frequently for whatever reason or has some flawed logic which requires manual intervention to fix data affected by the DAG processing, you can pause the DAG to keep it from executing even if the DAG has a regular schedule_interval.
There are other scenarios but pausing DAGs is helpful if you want to prevent DAG execution caused by an expected or even unexpected triggering.

Win 10 Task Scheduler keeps disabling tasks

I use Task Scheduler to run a .bat file that zips and encrypts files and does a nightly backup of them to an external drive. I have used this for years and it has worked just fine. Starting a couple of months ago, the task is getting disabled in Task Scheduler and I cannot figure out why. I can enable it, and it will run again, but then gets disabled again the same day or in the next day or two. Then I noticed that it is not just this task, but other scheduled tasks (that I did not write) that are also getting disabled, all at the same time. Things like Google software update are getting disabled too.
I have been looking at the task history to see when tasks are disabled, and there is no common denominator that I can think of.
When I restart, all tasks are enabled. But what causes them to be disabled?????
I had this for months before I narrowed it down; with the help of posts from the likes of Paul above. Every task kept getting disabled, sometimes several times a day. In my case it was AVG anti-virus.
In AVG settings there is a tools menu, in there is a series of check boxes called "Do Not Disturb Mode". It seems AVG is trying to 'help' the user by not disturbing him if he is running a program full screen by turning off notifications, but it's over zealous and turns off all tasks too.
I unchecked all those tick boxes and didn't have the problem for two months. Then as a test I turned them on again and the tasks got disabled in just an hour or so.
I have had several AVG updates over the period and it's still present, so I don't think it's a bug as much as a feature.
I had the same problem that started in the last few weeks.
If you are running Avast anti-virus, there is bug [feature] that disables scheduled tasks and apparently never re-enables them. See this link: https://forum.avast.com/index.php?topic=249063.0
I had this problem last year. I believe if my memory serves me right that it happens when the Win 10 clock doesn't synchronise and the W32time service has stopped for some reason. If you go into task manager and select services, look for W32time and see if it is running. If it isn't right click and restart it
I had this problem last year. I believe if my memory serves me right that it happens when the Win 10 clock doesn't synchronise and the W32time service has stopped for some reason. If you go into task manager and select services, look for W32time and see if it is running. If it isn't right click and restart it
"Maintains date and time synchronization on all clients and servers in the network. If this service is stopped, date and time synchronization will be unavailable. If this service is disabled, any services that explicitly depend on it will fail to start."
Also check on Windows services for Windows Time to see if it is in manual or Automatic and change it to auto start (W32time)
Wow, thanks for this post. Would never have found out why my scheduled tasks are being disabled. I thought i was being hacked ! Ironically it is Avast's "Do not disturb feature". I had an app to auto-restart, and when this app restarted at the same clock time, all of my scheduled tasks would be disabled. Avast automatically decides to set multiple apps to "Do not disturb = True".
More details: https://forum.avast.com/index.php?topic=249063.0

WF4 -Get exceptions when using multiple ReceiveAndSendReply activities paralleled

I have a scenario and want to use multiple ReceiveAndSendReply activities running in parallel situation, each of them will be put in an infinite while loop to make sure all activities are always running and listening. So I used a parallel activity to pack all those ReceiveAndSendReply, and each ReceiveAndSendReply was put in a While activity with condition set to true. And of cause, I put some activities with business logic between Receive activity and SendReplyToRecieve activity.
Now I have a problem if it takes a long time to process a request in one branch, then during that time all other branches will be blocked. Any request for other Receive activities will not be processed, and both client, which include the one called long time run service and the other one who called other service during server process long time run service process, will also get exceptions.
Did anybody have an idea to fix it? Sorry since I am new user, can put post image of my workflow.
The workflow runtime is single treaded in that a given workflow instance only executes on a single thread at any given moment. So while your workflow is busy doing work it can't react to other incoming messages. Normally this isn't a problem as workflow's normally aren't compute intensive and doing async IO is real easy. One thing that might help is adding Delay activities with a real short timeout. They cause the workflow to pause letting it start processing the next request. Also make sure you put as few activities as you can between the Receive and the SendReply and add a short delay right after the SendReply.

Question reg. Parallel activity in workflow

Currently I see the parallel activity in WF 4.0 get completed either both the branches are completed or a certain condition is met but the activity I'm looking for should behave like this if any of the branch is completed the control has to transfer to the following activity without cancelling the other branch activity. Is there any activity in WF 4.0 should satisfy this need? or I have to create a custom activity for this purpose?
There is no activity that does this. The Parallel waits for all banches to complete or the CompletionCondition return true but then other branches a canceled as you describe.
What should happen to the other branches when the first is finished? They are scheduled so you have to do something with them or the scheduler will not see the "Parallel" activity as finished. That remains true even if you create your own activity.

Modelling a Notification System

I am trying to model a notification system where an event occurs during a time period (start date and end date). If the time period has been exceeded, the user is required to either update the time period or set a flag that the event has been i) cancelled, ii) completed, or iii) closed. If today is one day past the event's scheduled completion date, the manager is emailed. If two days, the manager and their supervisor is emailed. If > two days, the manager, their supervisor, and the company owner is emailed. Every day after that it emails the three of them that the event is delinquent. Events can be scheduled any time in the future so the process needs to simply track when the event is Pending, Active, Delinquent (past the end date), Cancelled, Closed, or Complete.
I have started building workflow as a WorkFlow Service application hosted in Windows Server AppFabric because it appears that that is the best way to persist this long-running workflow. I have also started using the WF State Machine Activity Pack CTP 1 as it seemed the best way to model these different event states.
I am uncertain how to model this process as well as get the process to persist and continue running in the background to monitor the event's state and behave as outlined above. I think I have all the states modeled correctly in the state machine. I am still trying to figure out the transitions from one state to another Any guidance is appreciated.
State Machines run in a burst of execution. There is really nothing to "run" while the workflow is persisted. I suspect what you mean is how will the workflow "wake up" when the timeout is exceeded.
The answer is that the Delay activity will create a durable timer. The AppFabric Workflow Management service periodically asks the persistence layer if there are runnable workflow instances - that is instances which have crashed or where a durable timer has expired.
Eventually the timer will be expired and the Workflow will be loaded and the Delay activity bookmark will be resumed.

Resources