A utility plugin running in the LiveCode IDE needs to complete a database update task every so often. It's important that the task isn't interrupted by the user - who may be working on another stack. Is there a way to disable the standard ctrl + period and avoid the task being stopped half way through it's cycle?
You can use the global 'allowInterrupts' property for this:
set the allowInterrupts to false
... task you don't want interrupted ...
set the allowInterrupts to true
While this property is false, Ctrl-Period will have no effect.
Related
I wrote a script to automate Weblogic deployments and during the undeploy and sometimes the deploy part of the script there is an error message that says, "The task cannot be processed further until the current edit session is activated. When this occurs, task processing will continue. The user can exit the deployer tool without affecting the task." When this happens I have to click the "Activate Changes" on the GUI of the admin console for the script to continue and do what I want it to do. Are there any WLST Jython programmers out there that know how to avoid this issue? I am trying to run the script without touching the GUI.
Also, sometimes the State of the managed server changes to 'deploy initializing'. When this happens I know that things are really messed up. I think this happens when I choose the other option "Undo All Changes".
There is a good answer of code for this in this blog
Its best to always do small bits, activate those changes and then proceed to the next task.
When doing an undeploy and deploy, its always better to undeploy, activate the change and then do a deploy and activate again, this way things remain clean else you may have conflicts when activating all changes in 1 go.
and no you dont have to activate from console, you can do from wlst using activate([timeout], [block])
Ensure to commit one transaction per session. This way you would not miss your earlier undeploy/deploy status due to the issue incurred by current deploy/undeploy task. Please find sample code block below.
app-list = [app1 app2 app3 ... app60]
for app in app-list:
edit()
startEdit()
app-path = "<path-to-your-apps>/" + app
deploy(app, app-path, targets=<your-targets>)
print 'deployed ' + app
activate()
Problem:
Before running A.story and B.story the Procondition.story must be run and finished because Precondition.story inserts data in the database which is then used by A.sotry and B.story.
There are few approaches I know to set this dependency but they are not applicable in this context.
'Givenstories' annotation is not of much help because in this case Precondition.story will run twice, first time for A.story and second time for B.story which results Precondition.story failure second time saying the data which it tries to insert into the database already exist.
Using Maven failsafe plugin This will certainly place the Precondition.story on top in the execution list but all these stories are run in multi-threading environment where there are 8 threads ready to grab the stories to run simultaneously. Thread 1 takes the Precondition.story but while that story is yet not completed A.story and B.story kick off by thread 2 and 3 that makes A.story and B.story fail.
Specify the story order overriding storyPath(): Does not work due to the same problem mentioned in #2 above.
Possible solution: How about maintaining the state of the Precondition.story say in a boolean variable preconditionCompleted. When the Precondition.story completes the preconditionCompleted is set to true. Then add a step in A.story and B.story at the beginning which does polling on preconditionCompleted every seconds until it becomes true and then execute the rest of the story.
For this purpose I need to know where can we declare such global variables to use across stories?
you can use Singleton class, which will contain some object. This object can be locked in #BeforeStory method of Precondition.story and released in #afterStory. Then in A and B story in #BeforeStory methods, you can wait until this object is released and then execute them.
Another way that I can think of is to make custom order annotation, but then you need to create logic to process it.
My program checks if there is a new version of itself. If yes it would exit and start an updater that replaces it and then restarts.
My problem is that I haven't found any info on how to make process start right after closing the actual program.
Any suggestions?
Thanks in advance
I intended to add a comment, but I'm too low in points here. The updater itself should probably contain a check to determine whether your application is running an instance, and it should contain a timeout loop that performs this check and factor the timeout following it's startup state. That way you can awaken it, and close your application. The updater should just determine your application is not running, compare versions perform the intended update operation.
a possible solution would also be to create a task via tash sceduler or cron job, starting an out of process application, like CMD.exe.. which brings me to my original comment-question: in regards to what Operating System(s) and Platform(s) is your program intended for?
I am developing an app in WinJS and I need to periodically run some tasks with a constant and specified delay between each pair of executions.
In particular, I am intending to update the user's position on the map every 30 seconds.
I am not quite sure how to implement the task scheduler in WinJS. I have looked at the background task class, but that doesn't seem to be much help in my case.
If Im reading this correctly and you simply want to do this while the application is running you just need a javascript timer - setTimeout.
note that with setTimeout you pass in the function itself without parenthesis, not a string name. Here's an app sample with a timer that updated the UI, although the main important takeaway here is that you need to make sure you call setTimeout again from within your 'update' function. Check out that code here
If you want some sort of background task to do this and generate a separate image (I dont think thats what you ant, but I'll include that since we're talking about tasks and delays)
If you are using Windows 8.1 (which releases soon) you can use the new scheduler class and pause and resume every 30 seconds as shown here
If you are using Windows 8 (and will work on 8.1) you can if I recall correctly setup your scheduled tasks every fifteen minutes and create one shot tasks for each 30 seconds within that time. run background task on timer
I'm trying to configure a set of build configurations in TeamCity 6 and am trying to model a specific requirement in the cleanest possible manner way enabled by TeamCity.
I have a set of acceptance tests (around 4-8 suites of tests grouped by the functional area of the system they pertain to) that I wish to run in parallel (I'll model them as build configurations so they can be distributed across a set of agents).
From my initial research, it seems that having a AcceptanceTests meta-build config that pulls in the set of individual Acceptance test configs via Snapshot dependencies should do the trick. Then all I have to do is say that my Commit build config should trigger AcceptanceTests and they'll all get pulled in. So, lets say I also have AcceptanceSuiteA, AcceptanceSuiteB and AcceptanceSuiteC
So far, so good (I know I could also turn it around the other way and cause the Commit config to trigger AcceptanceSuiteA, AcceptanceSuiteB and AcceptanceSuiteC - problem there is I need to manually aggregate the results to determine the overall success of the acceptance tests as a whole).
The complicating bit is that while AcceptanceSuiteC just needs some Commit artifacts and can then live on it's own, AcceptanceSuiteA and AcceptanceSuiteB need to:
DeploySite (lets say it takes 2 minutes and I cant afford to spin up a completely isolated one just for this run)
Run tests against the deployed site
The problem is that I need to be able to ensure that:
the website only gets configured once
The website does not get clobbered while the two suites are running
If I set up DeploySite as a build config and have AcceptanceSuiteA and AcceptanceSuiteB pull it in as a snapshot dependency, AFAICT:
a subsequent or parallel run of AcceptanceSuiteB could trigger another DeploySite which would clobber the deployment that AcceptanceSuiteA and/or AcceptanceSuiteB are in the middle of using.
While I can say Limit the number of simultaneously running builds to force only one to happen at a time, I need to have one at a time and not while the dependent pieces are still running.
Is there a way in TeamCity to model such a hierarchy?
EDIT: Ideas:-
A crap solution is that DeploySite could set a 'in use flag' marker and then have the AcceptanceTests config clear that flag [after AcceptanceSuiteA and AcceptanceSuiteB have completed]. The problem then becomes one of having the next DeploySite down the pipeline wait until said gate has been opened again (Doing a blocking wait within the build, doesnt feel right - I want it to be flagged as 'not yet started' rather than looking like it's taking a long time to do something). However this sort of stuff a flag over here and have this bit check it is the sort of mutable state / flakiness smell I'm trying to get away from.
EDIT 2: if I could programmatically alter the agent configuration, I could set Agent Requirements to require InUse=false and then set the flag when a deploy starts and clear it after the tests have run
Seems you go look on the Jetbrains Devnet and YouTrack tracker first and remember to use the magic word clobber in your search.
Then you install groovy-plug and use the StartBuildPrecondition facility
To use the feature, add system.locks.readLock. or system.locks.writeLock. property to the build configuration.
The build with writeLock will only start when there are no builds running with read or write locks of the same name.
The build with readLock will only start when there are no builds running with write lock of the same name.
therein to manage the fact that the dependent configs 'read' and the DeploySite config 'writes' the shared item.
(This is not a full productised solution hence the tracker item remains open)
EDIT: And I still dont know whether the lock should be under Build Parameters|System Properties and what the exact name format should be, is it locks.writeLock.MYLOCKNAME (i.e., show up in config with reference syntax %system.locks.writeLock.MYLOCKNAME%) ?
Other puzzlers are: how does one manage giving builds triggered by build completion of a writeLock task read access - does the lock get dropped until the next one picks up (which would allow another writer in) - or is it necessary to have something queue up the parent and child dependency at the same time ?