def runCloud(self, data): self.user_data.set_selected(1) service = backendservices(self.user_data) if not service.isOneOrMoreComputeNodesRunning(): raise Exception( 'No cloud computing resources found. (Have they been started?)' ) # If the seed is negative, this means choose a seed >= 0 randomly if int(data['seed']) < 0: random.seed() data['seed'] = random.randint(0, 2147483647) pymodel = self.construct_pyurdme_model(data) #logging.info('DATA: {0}'.format(data)) ##### cloud_params = { "job_type": "spatial", "simulation_algorithm": data['algorithm'], "simulation_realizations": data['realizations'], "simulation_seed": data['seed'], # "bucketname" : self.user_data.getBucketName(), #implys EC2, should be in backendservices "paramstring": '', } logging.debug('cloud_params = {}'.format(pprint.pformat(cloud_params))) cloud_params['document'] = pickle.dumps(pymodel) #logging.debug('PYURDME: {0}'.format(cloud_params['document'])) # Send the task to the backend cloud_result = service.submit_cloud_task(params=cloud_params) if not cloud_result["success"]: e = cloud_result["exception"] raise Exception("Cloud execution failed: {0}".format(e)) celery_task_id = cloud_result["celery_pid"] taskid = cloud_result["db_id"] job = SpatialJobWrapper() job.type = 'PyURDME Ensemble' job.user_id = self.user.user_id() job.startTime = time.strftime("%Y-%m-%d-%H-%M-%S") job.name = data["jobName"] job.indata = json.dumps(data) job.outData = None # This is where the data should be locally, when we get data from cloud, it must be put here job.modelName = pymodel.name job.resource = cloud_result['resource'] job.cloudDatabaseID = taskid job.celeryPID = celery_task_id job.status = "Running" job.output_stored = "True" job.put() return job
def runCloud(self, data): self.user_data.set_selected(1) service = backendservices(self.user_data) if not service.isOneOrMoreComputeNodesRunning(): raise Exception('No cloud computing resources found. (Have they been started?)') # If the seed is negative, this means choose a seed >= 0 randomly if int(data['seed']) < 0: random.seed() data['seed'] = random.randint(0, 2147483647) pymodel = self.construct_pyurdme_model(data) #logging.info('DATA: {0}'.format(data)) ##### cloud_params = { "job_type": "spatial", "simulation_algorithm" : data['algorithm'], "simulation_realizations" : data['realizations'], "simulation_seed" : data['seed'], # "bucketname" : self.user_data.getBucketName(), #implys EC2, should be in backendservices "paramstring" : '', } logging.debug('cloud_params = {}'.format(pprint.pformat(cloud_params))) cloud_params['document'] = pickle.dumps(pymodel) #logging.debug('PYURDME: {0}'.format(cloud_params['document'])) # Send the task to the backend cloud_result = service.submit_cloud_task(params=cloud_params) if not cloud_result["success"]: e = cloud_result["exception"] raise Exception("Cloud execution failed: {0}".format(e)) celery_task_id = cloud_result["celery_pid"] taskid = cloud_result["db_id"] job = SpatialJobWrapper() job.type = 'PyURDME Ensemble' job.user_id = self.user.user_id() job.startTime = time.strftime("%Y-%m-%d-%H-%M-%S") job.name = data["jobName"] job.indata = json.dumps(data) job.outData = None # This is where the data should be locally, when we get data from cloud, it must be put here job.modelName = pymodel.name job.resource = cloud_result['resource'] job.cloudDatabaseID = taskid job.celeryPID = celery_task_id job.status = "Running" job.output_stored = "True" job.put() return job