Running two instances of project at the same time

View some of the Frequently Asked Questions to our support staff. Included are some tips and tricks making this forum ideal for users getting started with GoAnywhere Director. Note: Users can reply to existing topics but only our support staff can add new topics to this forum.
3 posts Page 1 of 1

Support_Julie

User avatar
Support Specialist
Posts: 91
Joined: Thu Mar 05, 2009 3:49 pm
Location: Ashland, NE USA

Post by Support_Julie » Mon Mar 23, 2009 1:06 pm
By default, a project can only have one instance running at a time. If you try to kick off a project that already has an instance running you will receive an error. The error message will look like "Project 'Test Project' is defined as not thread safe and an instance with job number '1223344556677' is already running". You may also see this error message "MSG GAE9898" if you tried to execute the project using the RunProject command.

If you would like to run multiple instances of this project simultaneously please follow the steps below:

1) Login into the GoAnywhere client and edit the project.
2) With the project node selected in the Project Outline (this is selected by default when you click on the edit button for a project) click on the Advanced tab.
3) Change the thread-safe option to "true".

The Thread-Safe option will specify whether or not it is safe to run multiple instances of this project simultaneously. The default value is false. A value of false ensures that only one instance of the project is active at any given time.
Julie Rosenbaum
Sr Support Analyst
e. [email protected]
p. 1.800.949.4696
w. HelpSystems.com

sivakurapati

Posts: 2
Joined: Mon Nov 08, 2010 10:16 am

Post by sivakurapati » Mon Nov 08, 2010 11:02 am
Hi Julie,

Thanks for the information about the multiple instances of a project.

I have a scenario, where I have my project set to "false" for thread-safe option. I have in my task "Execute Native Command" set to "true" for error out if the executable fails, so that I can use this option to send an email from the job scheduler whenever my scheduled job fails.

In this scenario I am receiving email when a new instance of the project is getting scheduled while an existing instance of the project is already running since I mentioned the project as not thread safe, this email I consider it as spam. How to avoid sending an email for the case of running mulitple instances of a projects when the project is stated as not thread safe.

I tried to include the option of email in the project itself, but in this case I am not able to get access to the job Log file.

Thanks in advance
Siva kurapati

RElliott63

Posts: 14
Joined: Thu Jul 01, 2010 10:42 am

Post by RElliott63 » Tue Jul 05, 2011 2:26 pm
To add to this issue, there are instances where multiple iterations of a Thread-Safe Project need to run and are triggered back to back. I ran across this several times and was given the "Cannot run, Project is not thread-safe" error message. But, I still needed the 2nd job to execute after the first was completed. So, I came up with the following Project Codes that I use in a "Utility" fashion.

In this case, I chose to give the process 20 - 10 Second Delays before timing out. This gave me a controllable Front-End to my Projects to trap the Thread-Safe Errors and Still be able to end normally or submit the job with a sufficient amount of wait time.
Code: Select all
<project name="Run Project" mainModule="Main" version="1.0" threadSafe="true" logLevel="debug">

  <!-- Parms Passed -->
	<variable name="pFolder"  value=" " description="Project Folder" />
	<variable name="pProject" value=" " description="Project Name" />

  <module name="Main" dependsOn="Check Parms,Check Status,Run Project">

    <print label="Status - Successful" version="1.0" executeOnlyIf="'${CheckJob}' eq 'Yes'">
      <![CDATA[
*==========================================================================*
* "${pFolder}/${pProject}" Active?  ${pActive}
*
* No/Tries:  ${Tries}        
*==========================================================================*
      ]]>
    </print>

    <print label="Status - UnSuccessful" version="1.0" executeOnlyIf="( '${CheckJob}' eq 'Yes' ) and ( ${Tries} gt 10 )">
      <![CDATA[
*==========================================================================*
* Run Job Unsuccessful - Number of Retries exceeded!
*
* No/Tries:  ${Tries}        
*==========================================================================*
      ]]>
    </print>

    <print label="Status - Invalid Parms" version="1.0" executeOnlyIf="'${CheckJob}' eq 'No'">
      <![CDATA[
*==========================================================================*
* Invalid Parameters Passed:
* 
*     Folder:   ${pFolder}
*     Project:  ${pProject}
*==========================================================================*
      ]]>
    </print>

  </module>

  <module name="Check Parms">

    <setVariable label="Set CheckJob"     version="1.0" name="CheckJob" value="Yes" />
    <setVariable label="Check for Blanks" version="1.0" name="CheckJob" value="No" executeOnlyIf="( '${pFolder}' eq ' ' ) or ( '${pProject}' eq ' ' )"/>
    <setVariable label="Check for Null"   version="1.0" name="CheckJob" value="No" executeOnlyIf="( '${pFolder}' eq '' )  or ( '${pProject}' eq ''  )"/>

  </module>

  <module name="Check Status" executeOnlyIf="'${CheckJob}' eq 'Yes'" >

		<setVariable label="Set Active" version="1.0" name="Active" value="No" />
		<setVariable label="Set Tries"  version="1.0" name="Tries"  value="1" />
		
    <forLoop label="Check Project Status" beginIndex="1" endIndex="20" step="1" currentIterationVariable="Tries" >

      <callProject label="Get Project Status" version="1.0" project="/Utilities/Get Project Status" inheritUserVariables="true" returnUserVariables="true" >
  			<variable name="pFolder"  value="${pFolder}"  />
  			<variable name="pProject" value="${pProject}" />
  			<variable name="pActive"  value=" " />
  		</callProject>

      <setVariable label="Set Active" version="1.0" name="Active" value="${pActive}" />

      <exitLoop condition="'${Active}' eq 'No'" />

      <delay label="Try Delay" version="1.0" time="${Delay}" timeUnit="seconds" />
      
      <setVariable label="Set Error"    version="1.0" name="Error"    value="0" />
      <setVariable label="Set SubError" version="1.0" name="SubError" value="0" />

    </forLoop>
    
  </module>

  <module name="Run Project" executeOnlyIf="'${Active}' eq 'No'">

    <callProject label="Submit Job" project="/${pFolder}/${pProject}" runInSameJob="false" mode="batch" version="1.0" />

  </module>

	<variable name="Delay" value="10" description="Amount of Delay in Seconds" />

	<description>Run Project checking for Thread-Safe</description>

</project>
Code: Select all
<project name="Get Project Status" mainModule="Main" version="1.0" threadSafe="true" logLevel="debug">

  <!-- Parms Passed -->
	<variable name="pFolder"  value=" " description="Project Folder" />
	<variable name="pProject" value=" " description="Project Name" />
	<variable name="pActive"  value=" " description="Return Value - (Yes) or (No)" />

  <module name="Main" dependsOn="Check Parms,Check Project">

    <print label="Status - Successful" version="1.0" executeOnlyIf="'${CheckJob}' eq 'Yes'">
      <![CDATA[
*==========================================================================*
*     
* "${pFolder}/${pProject}" Active?  ${pActive}
*        
*==========================================================================*
      ]]>
    </print>

    <print label="Status - Invalid Parms" version="1.0" executeOnlyIf="'${CheckJob}' eq 'No'">
      <![CDATA[
*==========================================================================*
*     
* Invalid Parameters Passed:
* 
*     Folder:   ${pFolder}
*     Project:  ${pProject}
*        
*==========================================================================*
      ]]>
    </print>

  </module>

  <module name="Check Parms">

    <setVariable label="Set CheckJob"     version="1.0" name="CheckJob" value="Yes" />
    <setVariable label="Check for Blanks" version="1.0" name="CheckJob" value="No" executeOnlyIf="( '${pFolder}' eq ' ' ) or ( '${pProject}' eq ' ' )"/>
    <setVariable label="Check for Null"   version="1.0" name="CheckJob" value="No" executeOnlyIf="( '${pFolder}' eq '' )  or ( '${pProject}' eq ''  )"/>

  </module>

  <module name="Check Project" executeOnlyIf="'${CheckJob}' eq 'Yes'" >

    <setVariable label="Set SubError" version="1.0" name="SubError" value="0" />
    <sql label="Check GADerby" resourceId="GADerby" version="1.0" onError="setVariable:SubError=2" >
      <query label="See if Active" outputVariable="OutPut" whenNoDataFound="error">
        <statement>
Select Count( * ) 
  From APP.DPA_JOB 
 Where Proj_Folder = &apos;/${pFolder}&apos; 
   and Proj_Name   = &apos;${pProject}&apos;
   and Status      = &apos;A&apos; 
        </statement>
      </query>
    </sql>

    <setVariable label="Set pActive" name="pActive" value="No"  version="1.0" executeOnlyIf="( ${SubError} gt 0 ) or ( ${OutPut[1]} eq 0 )"/>
    <setVariable label="Set pActive" name="pActive" value="Yes" version="1.0" executeOnlyIf="${OutPut[1]} gt 0"/>
    
  </module>

	<description>Get Project Status</description>

</project>
3 posts Page 1 of 1