Save uuid associated with project we just created.
        :param result_id: str: uuid of the project
543730
def after_run(self, result_id):
        
        self.local_project.set_remote_id_after_send(result_id)
        self.settings.project_id = result_id
108736
def collect_results(project, force=False):
    """"""
    if not project.crawlable:
        return project

    now = datetime.datetime.now()

    if (now - project.updated_at).total_seconds() < 4 and (not force):
        return project

    result_paths = []
    if os.path.isdir(project.path_name):
        result_paths.extend(_list_result_paths(project.path_name))

    registered_results = db.session.query(Result.path_name).filter_by(
        project_id=project.id
    ).all()
    registered_paths = {r.path_name for r in registered_results}

    for result_path in result_paths:
        if result_path not in registered_paths:
            _register_result(project.id, result_path)

    project.updated_at = datetime.datetime.now()

    db.session.commit()

    return project
670652
def post_commit(self, results):
        ''''''
        tpy = self._meta.pk_to_python
        instances = []
        deleted = []
        errors = []
        # The length of results must be the same as the length of
        # all committed instances
        for result in results:
            if isinstance(result, Exception):
                errors.append(result.__class__('Exception while committing %s.'
                                               ' %s' % (self._meta, result)))
                continue
            instance = self.pop(result.iid)
            id = tpy(result.id, self.backend)
            if result.deleted:
                deleted.append(id)
            else:
                if instance is None:
                    raise InvalidTransaction('{0} session received id "{1}"\
 which is not in the session.'.format(self, result.iid))
                setattr(instance, instance._meta.pkname(), id)
                instance = self.add(instance,
                                    modified=False,
                                    persistent=result.persistent)
                instance.get_state().score = result.score
                if instance.get_state().persistent:
                    instances.append(instance)
        return instances, deleted, errors
925087
def _handle_result(self, result):
        
        is_ephemeral = result.node.is_ephemeral_model
        if not is_ephemeral:
            self.node_results.append(result)

        node = CompileResultNode(**result.node)
        node_id = node.unique_id
        self.manifest.nodes[node_id] = node

        if result.error is not None:
            if is_ephemeral:
                cause = result
            else:
                cause = None
            self._mark_dependent_errors(node_id, result, cause)
1126952
def get_instance_for_uuid(self, uuid, project_id):
        
        instance_name = self._inst_info_cache.get((uuid, project_id))
        if instance_name:
            return instance_name
        instances = self._get_instances_for_project(project_id)
        for inst in instances:
            if inst.id.replace('-', '') == uuid:
                LOG.debug('get_instance_for_uuid: name=%s', inst.name)
                instance_name = inst.name
                self._inst_info_cache[(uuid, project_id)] = instance_name
                return instance_name
        return instance_name
74395
def edit_project(self, id_, **kwargs):
        
        data = self._wrap_dict("project", kwargs)
        return self.patch("/projects/{}.json".format(id_), data=data)
451823
def set_project_id(self, project_id):
    
    self._project_id = project_id
    if self == Context._global_context:
      du.save_project_id(self._project_id)
203423
def result_to_event(result)
      { :type => "Result",
        :from => result.from,
        :data => {
          :result => result.results,
          :duration => result.duration,
          :request_uuid => result.token,
          :request_from => result.request_from } }
    end
509479
def save
      result = validate
      fail result unless result == true
      @log.debug(to_json)
      if handlerId
        @client.update_event_handler(handlerId, to_json)
      else
        @client.create_event_handler(to_json)
      end
    end
333978
def _submit_results(self):
        
        if self._cur_res_id and self._cur_values:
            # Setting DefaultResult just because it is obligatory.
            self._addRawResult(self._cur_res_id, self._cur_values)
            self._reset()
1244265
def _send_result_to_redis(self, result):
        """"""
        if self.redis_connected:
            self.logger.debug("Sending result to redis")
            try:
                key = "rest:poll:{u}".format(u=result['uuid'])
                self.redis_conn.set(key, json.dumps(result))
            except ConnectionError:
                self.logger.error("Lost connection to Redis")
                self._spawn_redis_connection_thread()
        else:
            self.logger.warning("Unable to send result to redis, not connected")
704680
def set_project_id(self, project_id):
    
    self._project_id = project_id
    if self == Context._global_context:
      try:
        from google.datalab import Context as new_context
        new_context.default().set_project_id(project_id)
      except ImportError:
        # If the new library is not loaded, then we have nothing to do.
        pass
1312297
def save(self, *args, **kwargs):
        
        if not self.id:  # this is a totally new instance, create uuid value
            self.url_uuid = str(uuid.uuid4()).replace("-", "")
        super(ObfuscatedUrlInfo, self).save(*args, **kwargs)
467021
def modify_project(project_id, opts = {})
      data, _status_code, _headers = modify_project_with_http_info(project_id, opts)
      return data
    end
415220
def _add_results(self, results, trial_id):
        
        for result in results:
            self.logger.debug("Appending result: %s" % result)
            result["trial_id"] = trial_id
            result_record = ResultRecord.from_json(result)
            result_record.save()
630253
def store(self, report, test_id):
        '''
        
        '''
        report_d = report.to_dict()
        content = self._serialize_dict(report_d)
        report_id = self.insert(
            ['test_id', 'content', 'status', 'reason'],
            [test_id, content, report.get_status(), report.get('reason')],
        )
        return report_id
920152
def view_project_details(self, project_id):
        
        data = self._run(
            url_path="projects/view",
            id=project_id
        )
        return self._project_formatter(data['result']['project'])