def run_hack( run_id ): mask_id = ["[%i,%i)" % (i, i+5) for i in range(4,16)] mask_id += ["[4,20)", "[4,12)", "[12,20)"] str_join = ','.join(mask_id) aggregator_settings = { 'masks': str_join, 'results_bucket': 'an-hdproject-csvs', 'archive_bucket': 'an-hdproject-data-archive' } run_mdl.update_ANRun( run_id, aggregator_settings=aggregator_settings )
def PATCH( self, request): """ Insert/update run """ self.app.logger.info("Run.PATHC()") req = self._req_to_dict( request ) self.app.logger.debug( "request %r" % req ) #make no distinction between insert and update #testing autopush req.pop('run_id', None)#remove run_id from dict, using self.run_id req.pop('date_created', None) #created is non-writeable if 'status' in req and req['status'] not in [0, 30]: #only initialize or abort req.pop('status') #status unwriteable from web exists = run.get_ANRun( self.run_id ) if exists: self.app.logger.info("Update %s" % self.run_id ) result = run.update_ANRun( self.run_id, **req ) else: #all new runs start in the config status self.app.logger.info("Insert %s" % self.run_id ) req['status'] = run.CONFIG result = run.insert_ANRun( self.run_id, **req ) result = self._clean_response( result ) msg = {'status': 'complete', 'data': result } return (msg, 200)