Load Test Output
In this tutorial, we will show you how to use Neocortix Cloud Services Scalable Compute to run a distributed batch Python job, accessing information about the devices' approximate location.
First, please follow the steps in the tutorial Setting Up For Batch Jobs. After completion of the initial setup, you will have a directory with examples,
In the subdirectory
you will find the runBatchLocation.py command. This script will create a set of instances running on mobile devices, one instance for each frame to be computed (10 in the default example provided).
startFrame = 1, endFrame = 10,
It will command the instances to run the simple example Python code supplied in file
workerScriptPath = 'helloLocation.py' def frameCmd( self, frameNum ): pythonFileName = os.path.basename( self.workerScriptPath ) cmd = 'python3 %s %d | tee %s' % \ (pythonFileName, frameNum, self.frameOutFileName(frameNum) ) return cmd
The output will be a simple text file
indicating the approximate location of the device, derived from its IP address. These files will be sent back to the master host, and the master will then terminate the instances.

Example Command

Simply run
python3 ./runBatchLocation.py
When the program is done, the output files will be put in a directory

Example Output

$ more frame_*.out :::::::::::::: frame_1.out :::::::::::::: Hello from "Chattanooga, TN, United States" (US.TN.Chattanooga) {'latitude': 35.1587, 'longitude': -85.2163, 'display-name': 'Chattanooga, TN, U nited States', 'country': 'United States', 'country-code': 'US', 'area': 'TN', ' locality': 'Chattanooga'} :::::::::::::: frame_2.out :::::::::::::: Hello from "Lompoc, CA, United States" (US.CA.Lompoc) {'latitude': 34.6608, 'longitude': -120.4424, 'display-name': 'Lompoc, CA, Unite d States', 'country': 'United States', 'country-code': 'US', 'area': 'CA', 'loca lity': 'Lompoc'} :::::::::::::: frame_3.out :::::::::::::: Hello from "Gainesville, FL, United States" (US.FL.Gainesville) {'latitude': 29.7005, 'longitude': -82.308, 'display-name': 'Gainesville, FL, Un ited States', 'country': 'United States', 'country-code': 'US', 'area': 'FL', 'l ocality': 'Gainesville'}