

def __report_expr_status(self, expr):
    ret = {
        'expr_id': str(expr.id),
        'status': expr.status,
        'hackathon_name': (expr.hackathon.name if expr.hackathon else ''),
        'hackathon': (str(expr.hackathon.id) if expr.hackathon else ''),
        'create_time': str(expr.create_time),
        'last_heart_beat_time': str(expr.last_heart_beat_time),
    }
    if (expr.status != EStatus.RUNNING):
        return expr
    remote_servers = []
    for ve in expr.virtual_environments:
        if (ve.remote_provider == VERemoteProvider.Guacamole):
            try:
                guacamole_config = ve.remote_paras
                guacamole_host = self.util.safe_get_config('guacamole.host', 'localhost:8080')
                name = guacamole_config['name']
                url = (guacamole_host + ('/guacamole/#/client/c/%s?name=%s' % (name, name)))
                remote_servers.append({
                    'name': guacamole_config['name'],
                    'guacamole_host': guacamole_host,
                    'url': url,
                })
            except Exception as e:
                self.log.error(e)
                ret['status'] = EStatus.STARTING
                return ret
    ret['remote_servers'] = remote_servers
    public_urls = []
    if (expr.template.provider == VE_PROVIDER.DOCKER):
        for ve in expr.virtual_environments:
            container = ve.docker_container
            for p in container.port_bindings.filter(is_public=True):
                if p.url:
                    public_urls.append({
                        'name': p.name,
                        'url': p.url.format(container.host_server.public_dns, p.public_port),
                    })
    else:
        for ve in expr.virtual_environments:
            vm = ve.azure_resource
            if ((not vm) or (not vm.end_points)):
                continue
            for endpoint in vm.end_points:
                if endpoint.url:
                    public_urls.append({
                        'name': endpoint.name,
                        'url': endpoint.url.format(vm.dns, endpoint.public_port),
                    })
    ret['public_urls'] = public_urls
    return ret

dataset/ETHPy150Open msopentechcn/open-hackathon/open-hackathon-server/src/hackathon/expr/expr_mgr.py ExprManager.__report_expr_status/VarMisuse@106/155 `ret`->`expr`