@@ -197,18 +197,6 @@ def setVerbose(self, verbose):
197
197
"""
198
198
self .simParams .verbose = verbose
199
199
200
-
201
- def setJobNumber (self , job_number ):
202
- """
203
- Set the job number of the simulation.
204
- Used in AWS work to modify the seed used in dispersion.
205
- Should be set to $AWS_BATCH_JOB_ARRAY_INDEX
206
-
207
- :param job_number:
208
- :return:
209
- """
210
- self .simParams .job_number = job_number
211
-
212
200
def setDispMagnitudeFile (self , magnitudes ):
213
201
"""
214
202
Save .txt with the magnitude of each dispersion in % or sigma away from mean
@@ -724,7 +712,7 @@ class SimulationParameters():
724
712
def __init__ (self , creationFunction , executionFunction , configureFunction ,
725
713
retentionPolicies , dispersions , shouldDisperseSeeds ,
726
714
shouldArchiveParameters , filename , icfilename , index = None , verbose = False , modifications = {},
727
- showProgressBar = False , job_number = 1 ):
715
+ showProgressBar = False ):
728
716
self .index = index
729
717
self .creationFunction = creationFunction
730
718
self .executionFunction = executionFunction
@@ -740,7 +728,19 @@ def __init__(self, creationFunction, executionFunction, configureFunction,
740
728
self .dispersionMag = {}
741
729
self .saveDispMag = False
742
730
self .showProgressBar = showProgressBar
743
- self .job_number = job_number
731
+
732
+ self .job_number = self .getJobNumber ()
733
+
734
+ @staticmethod
735
+ def getJobNumber ():
736
+ """
737
+ Get the job number of the simulation
738
+ Utilized in AWS Batch runs to modify the seed used in dispersion.
739
+
740
+ :return: Job Array Index, or 0 if not running in AWS Batch.
741
+ """
742
+ job_number = os .environ .get ('AWS_BATCH_JOB_ARRAY_INDEX' , 0 )
743
+ return job_number
744
744
745
745
746
746
class SimulationExecutor :
0 commit comments