Start AM with all flows disabled ...

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
webtrekker
Posts: 14
Joined: 30 May 2019 23:58

Start AM with all flows disabled ...

Post by webtrekker » 19 Jul 2019 11:25

Is it possible to start the AM app with all flows set to the disabled/OFF state? I have a flow using a timer that is set to too low a value and is causing AM to crash repeatedly. There's no way I can stop the flow long enough to be able to go into AM and disable it.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Start AM with all flows disabled ...

Post by Martin » 19 Jul 2019 18:57

Hi,

The easiest way is likely to ensure Automagic is stopped then use a text editor to edit flows.xml in external storage (usually under /storage/emulated/0/Automagic/flows.xml. Append a space at the end of a line of your choice or add a newline at the end of the file, save the file and start Automagic again. Automagic should now warn that the flows.xml file was modified externally and allows to load the flows but Automagic will not enable the flows.

Another option is to uninstall Automagic, rename the flows.xml file, install and start Automagic and then import the flows from the renamed file.

Would be great if you could send me the flow that caused this problem so I can check how this can be prevented in the future. The emergency stop should usually disable such flows automatically.

Regards,
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Start AM with all flows disabled ...

Post by Desmanto » 20 Jul 2019 02:39

@webtrekker : You can open flows.xml as pointed out by Martin, use Text Editor that you prefer. I use MiXplorer text/code editor. Then search for the flow name (hope you remember it). It should be at the end part of the xml. (the order is trigger - condition - action - flow). You should find something like this.

Code: Select all

  <flow type="flow">
    <name>AM Tools</name>
    <group>AM Tools</group>
    <enabled>true</enabled>
    <lastExecutionStartTime>1563472920746</lastExecutionStartTime>
    <lastExecutionEndTime>1563472922473</lastExecutionEndTime>
    <executionPolicy>PARALLEL</executionPolicy>
    <emergencyStopCount>200</emergencyStopCount>
To disable it, simply change the enabled tag to false

Code: Select all

    <enabled>false</enabled>
Start automagic, that flow should be disabled already.


@Martin : I remember you have some unofficial method to disable the flow, by creating a file in Automagic folder, but can't find it anywhere. Or maybe it is to disable the Automagic altogether?

I think the other alternative solution is to have another extra menu - "View Flows" in the maintenance, where we can view the flow stats without enabling the Automagic services. This way, we can browse to the culprit flow and disable it before starting automagic service.

Proposed "View Flows" also can benefit to have a bigger picture on all flow. I have to create my own flow to show this information. We don't need to browse inside the flow, but simply to show the summary of the flow. It will have summary with columns
Flow name - Group - State - Last Execution Time - Last Execution Duration - Execution Policy - Emergency Stop
It will be great if we can search, filter and sort the data based on each column. Example to view the flows those have been executed up to 10 minutes ago.

This is just additional idea I thought about. I need to type and post it now, or I will forget again to request this. No need to rush this in 1.38. :)
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
webtrekker
Posts: 14
Joined: 30 May 2019 23:58

Re: Start AM with all flows disabled ...

Post by webtrekker » 20 Jul 2019 08:52

Thanks for that, it's all good now.

The problem was with a timer routine I was using to drive a graphics-intensive Tide Clock widget. The clock shows the current state of the tide at a local port along with a picture of a beach with the tide flowing in and out, synchronised to the clock.

The clock has to move the hand through 3 degrees every 6m 12s 500ms, which it was doing perfectly, however, I wanted to make a screen video of the thing in operation over the whole 360 degree range, so I dropped the timer value to 2s which apparently was way too small a value to allow the widget time to update and crashed AM.

Here's a pic of the widget at half-tide -

Screenshot_2019-06-29-11-49-56.png
Screenshot_2019-06-29-11-49-56.png (984.63 KiB) Viewed 12745 times

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Start AM with all flows disabled ...

Post by Desmanto » 20 Jul 2019 18:03

Nice widget there. How long does it take to update the 3 degree movement? I also have a very intensive Widget, contains 400 elements, which are actually bars for the signal chart. It takes about 600-700 ms to update all of them using my previous phone. While current phone can update them in 200-300 ms. So I can still have the loop every seconds and not running into crash. Maybe you can optimize the flow so it update faster than 2s, then you should have no problem dropping the timer to 2 seconds.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
webtrekker
Posts: 14
Joined: 30 May 2019 23:58

Re: Start AM with all flows disabled ...

Post by webtrekker » 20 Jul 2019 21:36

To be honest Desmanto I only wanted to sweep the hand around quickly in order to take a screen video of a full 360 degree sweep. I've found a timer value of 5s adequate for this.

However, in normal operation, I have the timer set to 6m 12s 500ms which produces a full 360 degree sweep, in 3 degree steps, that takes 12h 25m 00s, ie. half a lunar day. This keeps the clock synchronised to the tides, once it has been set at high or low tide for the port in question.

These clocks (as with their mechanical counterparts) drift slightly over time so need resetting at intervals. The best time to set them is at a full moon, using high or low tide data from the internet. After that, the clock will work quite accurately without an internet connection until the next reset.

I could have made it so that it pulls regular tide times from the Admiralty Maritime site via HTTP requests that provide a JSON response (and I have actually done this) but I thought it was more important to be able to keep tide times without regular web access as these types of clock may be used by mariners with no permanent Internet connection.

Here's a speeded-up video of a single sweep of the clock which, under normal circumstances, would take 12h 35m and not 1m 34s! -

http://fudgeys.co.uk/tide_widget_cycle_fast.mp4

The purpose of all of this is to eventually produce a native Android app and/or widget, which is what I'm currently working on using Basic4android (B4A).

Hope this hasn't bored too many of you! :mrgreen:

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Start AM with all flows disabled ...

Post by Desmanto » 21 Jul 2019 17:51

Oh, you have the changing image also, so it takes some time to load. Making it 2s maybe is too fast for the repeated operation. I am thinking to make a widget to show my internet quota too now, and have the data change every day. But still have other flows to finish too.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply