def getProjectList(showall=False):
    projectsdata = projectdata.projects()
    projectlist = projectsdata.query()
    if showall is True:
        return projectlist
    ### select only projects that have recently collected data
    selectedprojects = []
    currentyear = time.localtime()[0]
    for project in projectlist:
        sessiondata = getLatestSession(project)
        year = int(str(sessiondata.timestamp)[:4])
        if year > currentyear - 1:
            selectedprojects.append(project)
    return selectedprojects
def getProjectList(showall=False):
    projectsdata = projectdata.projects()
    projectlist = projectsdata.query()
    if showall is True:
        return projectlist
    ### select only projects that have recently collected data
    selectedprojects = []
    currentyear = time.localtime()[0]
    for project in projectlist:
        sessiondata = getLatestSession(project)
        year = int(str(sessiondata.timestamp)[:4])
        if year > currentyear - 1:
            selectedprojects.append(project)
    return selectedprojects
def copyProjectReferences(projectid, destination_base_path):
    '''
	Copy all sessions in the project identified by id number
	'''
    from leginon import projectdata
    p = projectdata.projects().direct_query(projectid)
    source_sessions = projectdata.projectexperiments(project=p).query()
    session_names = []
    for projectexpt in source_sessions:
        # skip None
        if projectexpt['session'] and projectexpt['session']['name']:
            session_names.append(projectexpt['session']['name'])
    session_names.reverse()  #oldest first

    for session_name in session_names:
        app = SessionReferenceCopier(session_name, destination_base_path)
        app.run()
        app = None
def copyProjectReferences(projectid,destination_base_path):
	'''
	Copy all sessions in the project identified by id number
	'''
	from leginon import projectdata
	p = projectdata.projects().direct_query(projectid)
	source_sessions = projectdata.projectexperiments(project=p).query()
	session_names = []
	for projectexpt in source_sessions:
		# skip None
		if projectexpt['session'] and projectexpt['session']['name']:
			session_names.append(projectexpt['session']['name'])
	session_names.reverse()  #oldest first

	for session_name in session_names:
		app = SessionReferenceCopier(session_name,destination_base_path)
		app.run()
		app = None
def archiveProject(projectid):
    '''
	Archive all users and sessions in the project identified by id number
	'''
    archiveEssentialUsers(projectid)

    print 'Finding sessions for the project....'
    from leginon import projectdata
    p = projectdata.projects().direct_query(projectid)
    source_sessions = projectdata.projectexperiments(project=p).query()
    session_names = map((lambda x: x['session']['name']), source_sessions)
    session_names.reverse()  #oldest first

    print 'Found %d sessions for the project' % (len(session_names))
    for session_name in session_names:
        # Don't archive sessions before 2011
        if int(session_name[:2]) < (YEAR - 2000):
            continue
        app = SessionArchiver(session_name)
        if SKIP_ARCHIVED and app.isSessionInArchive():
            print 'Session %s already archived' % session_name
            continue
        app.run()
        app = None
def archiveProject(projectid):
	'''
	Archive all users and sessions in the project identified by id number
	'''
	archiveEssentialUsers(projectid)

	print 'Finding sessions for the project....'
	from leginon import projectdata
	p = projectdata.projects().direct_query(projectid)
	source_sessions = projectdata.projectexperiments(project=p).query()
	session_names = map((lambda x:x['session']['name']),source_sessions)
	session_names.reverse()  #oldest first
	
	print 'Found %d sessions for the project' %  (len(session_names))
	for session_name in session_names:
		# Don't archive sessions before 2011
		if int(session_name[:2]) < (YEAR-2000):
			continue
		app = SessionArchiver(session_name)
		if SKIP_ARCHIVED and app.isSessionInArchive():
			print 'Session %s already archived' % session_name
			continue
		app.run()
		app = None
Ejemplo n.º 7
0
	def setDestinationProject(self, projectid):
		self.destination_project = None
		sinedon.setConfig('projectdata', db=self.destination_dbname)
		project = projectdata.projects().direct_query(projectid)
		self.destination_project = project
		self.reset()
Ejemplo n.º 8
0
	def setSourceProject(self, projectid):
		sinedon.setConfig('projectdata', db=self.source_dbname)
		self.source_project = projectdata.projects().direct_query(projectid)
	def setProject(self, projectid):
		self.project = projectdata.projects().direct_query(projectid)
 def setProject(self, projectid):
     self.project = projectdata.projects().direct_query(projectid)