hampsterx Posted February 28, 2012 Report Share Posted February 28, 2012 Hi All, Might be more of a linux question than plastic but here goes. I have a bash script that is being run on a plastic trigger (after-checkin). Basically it has some curl commands in there. I have set the flags on curl to limit connection time to 1 second and request time to 1 second. However, within plastic you can notice there is a delay when you checkin. It's not a big problem but it would be better if the script (or the curl commands) were run async so it didn't hold up the plastic client. I can understand *before* triggers needing to wait for the script finishes for a result to determine whether to cancel the operation but *after* doesn't make much sense to me. Anyhoo, someone got a quick fix? PS Very shortly I want to write up our plastic workflow/setup for the benefit of other web development teams, very satisfied with plastic TiM Link to comment Share on other sites More sharing options...
manu Posted March 2, 2012 Report Share Posted March 2, 2012 Mmmmmmm if you run from your trigger program a command with "nohup" first like this "nohup myAsycnProgram.sh &" I think your main trigger program can end and your Async program can continue.... Does it makes sense? PS Very shortly I want to write up our plastic workflow/setup for the benefit of other web development teams, very satisfied with plastic Cool!!! Thanks!!!! Link to comment Share on other sites More sharing options...
hampsterx Posted March 4, 2012 Author Report Share Posted March 4, 2012 *bingo*, perfect thnx. Surprised I didn't know this already but linux is not my forte. Link to comment Share on other sites More sharing options...
manu Posted March 5, 2012 Report Share Posted March 5, 2012 No problem! In windows/linux with c#/mono is easier, you can use the "Process" class. Link to comment Share on other sites More sharing options...
hampsterx Posted March 21, 2013 Author Report Share Posted March 21, 2013 oops, seems I never got this thing working correctly and it was/is always waiting on script to finish. Can you confirm plastic is not waiting for process to finish. If I try "nohup myAsycnProgram.sh &" It still waits for it to finish. Even if you try one script triggering another. it doesnt work either.. root@plastic:/opt# cm listtriggers 1 update subs /opt/pl.sh beta after-checkin /opt/pl.sh #!/bin/sh nohup /opt/plastic.sh & exit 0 If I run this from command line it always finishes right away, but from trigger it does not ! Thnx, TiM Link to comment Share on other sites More sharing options...
manu Posted March 21, 2013 Report Share Posted March 21, 2013 Can you check if the "/opt/pl.sh" keeps running? Link to comment Share on other sites More sharing options...
Gerald Posted March 22, 2013 Report Share Posted March 22, 2013 I also want to run a Python script after checkin. Really after because I want to retrieve to file changes of the checkin. Therefore I run the cm log command within the script. But at that time when the script runs the cm command the changeset doesn't exist yet. So, i tried to do this on Windows using start (asynchronous start of a process) but the plastic client still wait's until the script is finished. In the trigger i start a bat file that contains "start C:\python27\python.exe E:\aftercheckin.py" Why does the after-checkin trigger wait until all triggered programs are completed before commiting the changeset? Link to comment Share on other sites More sharing options...
manu Posted March 25, 2013 Report Share Posted March 25, 2013 We'll test it ASAP. Link to comment Share on other sites More sharing options...
calbzam Posted March 26, 2013 Report Share Posted March 26, 2013 Hello, I´ve tested some possibilities to run async after-checkin triggers: - In C# you can use the Process class. I´ve made some examples and the trigger works asynchronous from the checkin ( http://www.dotnetperls.com/process-start ) - In Python exists a Process class, but it seems that the trigger doesn't work asynchronous (http://docs.python.org/dev/library/multiprocessing.html) - If you are running python scripts, you may find this post interesting. It explains how to run a phyton script from a C# Process class (http://stackoverflow.com/questions/3823880/python-c-is-ironpython-absolutely-necessary). Best regards, carlos Link to comment Share on other sites More sharing options...
ydkim Posted September 10, 2013 Report Share Posted September 10, 2013 Hello, Is there any other way? I don't know C#... Cheers, YD Link to comment Share on other sites More sharing options...
calbzam Posted September 11, 2013 Report Share Posted September 11, 2013 Hi, You can create the script in any other language. In this post we explained the possibilities to run async after-checkin triggers in C# or Python using Process class, but you can find a similar way in other languages. Regards, Carlos Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.