Global Mapper Pro Coming Soon

Script query

AlvinAlvin Global Mapper UserPosts: 6
edited June 2010 in Technical Support
I have a situation where I have thousands of input tiles containing DEMs that I would like to transform to a different datum and project to UTM. As a consequence, I need to create many output tiles. I am going to create a unique script for each output tile and run it through Global Mapper executed via the command prompt. I have a load balancer that can submit jobs in the queue to a blade whenever it becomes free. Once the job is complete, the load balancer captures the status of the completed job and puts it in the database and distributes the next script to the next available blade. We have 12 blade units for processing.

In the case of running a script through Global Mapper on a command prompt, control is immediately returned back to the load balancer while the script is being processed as a scheduled task in the background. Is there a way to force Global Mapper to process the script in the foreground without immediately exiting? That is, wait until it is finished before returning control to the load balancer. The reason is that once control is returned back to the load balancer, it assumes the program has finished running so it will submit the next job to the blade. The blade will become quickly overwhelmed by the number of jobs being assigned to it by the load balancer.

It would also be advantageous to know if Global Mapper was successful or not in processing the script. By capturing the status, I can focus on only those output tiles that failed.

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    When you pass a script on the command line the .exe shouldn't return until until the script completes processing. Assuming you are using CreateProcess to call the .exe file, you should be able to do a WaitForSingleObject call on the .exe. When that function returns then you'll know the .exe has completed running the script.

    There won't be an error code returned, but if you use the SET_LOG_FILE script command you can have the script create a log file, then you could read that and look for any errors in that.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • AlvinAlvin Global Mapper User Posts: 6
    edited June 2010
    Hi Mike,

    I see what you are saying. I'll check with the programmers who developed our load balancer to see if they implemented the WaitForSingleObject call on the .exe. It didn't occur to me that executing GlobalMapper.exe through a CreateProcess behaves differently than executing it as a console application in the command shell.

    It would have been ideal if there was a switch I could set at the command line to instruct global mapper to return an integer value (0 for success, non 0 for failure) after running a script on the command prompt. We use the load balancer to run a slew of console applications, which all conform to this integer return behaviour. I'll have to work with the other group to see how we can get around this. Thanks for your prompt reply Mike. It was very helpful.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    I will take a look at making a script that generates an error return a non-zero value when the application exits.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    I have updated Global Mapper so you should now get a return code of 1 when running a script via the command line and an error occurs while running the script. I have placed a new build at http://www.globalmapper.com/global_mapper11.zip with the change for you to try. Simply download that file and extract the contents into your existing v11.xx installation folder to give it a try. If you are using the 64-bit version, there is a new build available at http://www.globalmapper.com/global_mapper11_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • AlvinAlvin Global Mapper User Posts: 6
    edited June 2010
    Thanks Mike,

    I'm working with our load balancer developers to test this new version out. I'll keep you posted on our results.
Sign In or Register to comment.