fetch active project from cache and inactive projects from db by project_id
492319
public Project getProject(final int id) {
    Project fetchedProject = this.projectsById.get(id);
    if (fetchedProject == null) {
      try {
        fetchedProject = this.projectLoader.fetchProjectById(id);
      } catch (final ProjectManagerException e) {
        logger.error("Could not load project from store.", e);
      }
    }
    return fetchedProject;
  }
1190195
def get_network_project(network_id, **kwargs):
    

    net_proj = db.DBSession.query(Project).join(Network, and_(Project.id==Network.id, Network.id==network_id)).first()

    if net_proj is None:
        raise HydraError("Network %s not found"% network_id)

    return net_proj
657319
public function getInactiveProjects()
    {
        $result = $this->getProjects();
        if ( $result->isSuccess() ) {
            $projects = array();
            foreach ($result->data as $project) {
                if ($project->active == "false") {
                    $projects[$project->id] = $project;
                }
            }
            $result->data = $projects;
        }

        return $result;
    }
1366002
def _update_projects(self):
        ''''''
        now = time.time()
        if (
                not self._force_update_project
                and self._last_update_project + self.UPDATE_PROJECT_INTERVAL > now
        ):
            return
        for project in self.projectdb.check_update(self._last_update_project):
            self._update_project(project)
            logger.debug("project: %s updated.", project['name'])
        self._force_update_project = False
        self._last_update_project = now
485002
def get_project(self, project_id):
        
        try:
            result = self._request('/getproject/',
                                   {'projectid': project_id})
            return TildaProject(**result)
        except NetworkError:
            return []
813133
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
    @JoinColumn(name="PROJECT_ID")
    public Project getProject()
    {
        return project;
    }
650879
def org_find_projects(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/findProjects' % object_id, input_params, always_retry=always_retry, **kwargs)
6974
def main(args=None):
    
    # parse args
    if args is None:
        args = parse_args(sys.argv[1:])

    # set logging level
    if args.verbose > 1:
        set_log_debug()
    elif args.verbose == 1:
        set_log_info()

    outpath = os.path.abspath(os.path.expanduser(args.out_dir))
    cachepath = os.path.abspath(os.path.expanduser(args.cache_dir))
    cache = DiskDataCache(cache_path=cachepath)

    if args.user:
        args.PROJECT = _pypi_get_projects_for_user(args.user)

    if args.query:
        DataQuery(args.project_id, args.PROJECT, cache).run_queries(
            backfill_num_days=args.backfill_days)
    else:
        logger.warning('Query disabled by command-line flag; operating on '
                       'cached data only.')
    if not args.generate:
        logger.warning('Output generation disabled by command-line flag; '
                       'exiting now.')
        raise SystemExit(0)
    for proj in args.PROJECT:
        logger.info('Generating output for: %s', proj)
        stats = ProjectStats(proj, cache)
        outdir = os.path.join(outpath, proj)
        OutputGenerator(proj, stats, outdir).generate()
1112578
def on_select_task(self, task):
        ''''''
        # inject informations about project
        logger.info('select %(project)s:%(taskid)s %(url)s', task)

        project_info = self.projects.get(task['project'])
        assert project_info, 'no such project'
        task['type'] = self.TASK_PACK
        task['group'] = project_info.group
        task['project_md5sum'] = project_info.md5sum
        task['project_updatetime'] = project_info.updatetime

        # lazy join project.crawl_config
        if getattr(project_info, 'crawl_config', None):
            task = BaseHandler.task_join_crawl_config(task, project_info.crawl_config)

        project_info.active_tasks.appendleft((time.time(), task))
        self.send_task(task)
        return task
675160
def fetch_synchronize_status():
    
    r = Response()
    project = cd.project.get_internal_project()

    if not project:
        r.fail(
            code='NO_PROJECT',
            message='No open project on which to retrieve status'
        )
    else:
        with open(project.source_path, 'r') as f:
            definition = json.load(f)

        result = status.of_project(project)
        r.update(
            sync_time=sync_status.get('time', 0),
            source_directory=project.source_directory,
            remote_source_directory=project.remote_source_directory,
            status=result,
            definition=definition
        )

    return r.flask_serialize()
789503
def show(ctx, project_id, backend):
    
    try:
        project = ctx.obj['projects_db'].get(project_id, backend)
    except IOError:
        raise Exception("Error: the projects database file doesn't exist. "
                        "Please run `taxi update` to create it")

    if project is None:
        ctx.obj['view'].err(
            "Could not find project `%s`" % (project_id)
        )
    else:
        ctx.obj['view'].project_with_activities(project)
1284953
public function getProject($id, $host = null, $refresh = null)
    {
        // Find the project in the user's main project list. This uses a
        // separate cache.
        $projects = $this->getProjects($refresh);
        if (isset($projects[$id])) {
            return $projects[$id];
        }

        // Find the project directly.
        $cacheKey = sprintf('%s:project:%s:%s', $this->sessionId, $id, $host);
        $cached = $this->cache->fetch($cacheKey);
        if ($refresh || !$cached) {
            $scheme = 'https';
            if ($host !== null && (($pos = strpos($host, '//')) !== false)) {
                $scheme = parse_url($host, PHP_URL_SCHEME);
                $host = substr($host, $pos + 2);
            }
            $project = $this->getClient()
                ->getProject($id, $host, $scheme !== 'http');
            if ($project) {
                $toCache = $project->getData();
                $toCache['_endpoint'] = $project->getUri(true);
                $this->cache->save($cacheKey, $toCache, $this->config->get('api.projects_ttl'));
            }
        } else {
            $guzzleClient = $this->getHttpClient();
            $baseUrl = $cached['_endpoint'];
            unset($cached['_endpoint']);
            $project = new Project($cached, $baseUrl, $guzzleClient);
        }

        return $project;
    }
386546
public List<ComponentDto> selectByProjectUuid(String projectUuid, DbSession dbSession) {
    return mapper(dbSession).selectByProjectUuid(projectUuid);
  }
948587
def _get_network(project_id, network_name, service):
    '''
    
    '''
    return service.networks().get(project=project_id,
                                  network=network_name).execute()
983887
public Project getProject(final String name) {
    Project fetchedProject = this.projectsByName.get(name);
    if (fetchedProject == null) {
      try {
        fetchedProject = this.projectLoader.fetchProjectByName(name);
        if (fetchedProject != null) {
          logger.info("Project " + name + " not found in cache, fetched from DB.");
        } else {
          logger.info("No active project with name " + name + " exists in cache or DB.");
        }
      } catch (final ProjectManagerException e) {
        logger.error("Could not load project from store.", e);
      }
    }
    return fetchedProject;
  }
85516
function downloadProjectCompilationsWithId(projectId, outputDir) {
	return fetchProject(projectId)
	.then((project) => {
		return downloadProjectCompilations(project, outputDir);
	})
	.catch((error) => {
		console.trace(error);
		throw error;
	});
}
675227
function (project_hash_id, cb) {

            _util.buildQuery('projects/' + project_hash_id, {}, function (error, data) {

                return cb(error, data);

            });

        }