示例#1
0
def home(request):
	"""
	Renders processing cart view.
	"""
	cartHasData = False
	if 'cart' not in request.session:
		request.session['cart'] = {'plugins' : {}}

	# Current items for user session
	cart_items = []
	for plugin, dataList in request.session['cart']['plugins'].iteritems():
		plugObj = manager.getPluginByName(plugin)
		if len(dataList):
			plugObj.setData(dataList)
			cartHasData = True
			cart_items.append(plugObj)
		else:
			plugObj.removeData()

	policies = CondorNodeSel.objects.filter(is_policy = True).order_by('label')
	selections = CondorNodeSel.objects.filter(is_policy = False).order_by('label')

	menu_id = 'processingcart'
	return render_to_response('processingcart.html', {	
        'cart_plugins' 		: cart_items, 
        'plugins' 			: manager.plugins, 
        'cartHasData' 		: cartHasData, 
        # Cluster node available policies + selections
        'policies'			: policies,
        'selections'		: selections,
        'selected_entry_id'	: menu_id, 
        'misc' 				: manager,
        'title' 			: get_title_from_menu_id(menu_id),
    },
    context_instance = RequestContext(request))
示例#2
0
文件: condor.py 项目: gotsunami/Youpi
def soft_version_monitoring(request):
    menu_id = "monitoring"
    return render_to_response(
        "softs_versions.html",
        {"report": len(settings.SOFTS), "selected_entry_id": menu_id, "title": get_title_from_menu_id(menu_id)},
        context_instance=RequestContext(request),
    )
示例#3
0
文件: condor.py 项目: gotsunami/Youpi
def monitoring(request):
    """
    Related to monitoring.
    This is a callback function (as defined in django's urls.py file).
    """
    menu_id = "monitoring"
    return render_to_response(
        "monitoring.html",
        {"selected_entry_id": menu_id, "title": get_title_from_menu_id(menu_id)},
        context_instance=RequestContext(request),
    )
示例#4
0
文件: tags.py 项目: gotsunami/Youpi
def home(request):
	"""
	Related to tags page.
	This is a callback function (as defined in django's urls.py file).
	"""
	menu_id = 'tags'
	return render_to_response('tags.html', { 
        'selected_entry_id'	: menu_id,
        'title' 			: get_title_from_menu_id(menu_id),
    }, 
    context_instance = RequestContext(request))
示例#5
0
文件: condor.py 项目: gotsunami/Youpi
def home(request):
    """
    Condor cluster setup
    """
    menu_id = "condorsetup"
    return render_to_response(
        "condorsetup.html",
        {
            "custom_condor_req": request.user.get_profile().custom_condor_req,
            "selected_entry_id": menu_id,
            "title": get_title_from_menu_id(menu_id),
        },
        context_instance=RequestContext(request),
    )
示例#6
0
def home(request):
    """
    Related to results page.
    This is a callback function (as defined in django's urls.py file).
    """
    dirs = []
    active_users = User.objects.filter(is_active = True)
    menu_id = 'results'
    return render_to_response('results.html', { 
        'tags'              : Tag.objects.all().order_by('name'),
        'users'             : active_users,
        'plugins'           : manager.plugins, 
        'selected_entry_id' : menu_id, 
        'title'             : get_title_from_menu_id(menu_id),
    }, 
    context_instance = RequestContext(request))
示例#7
0
def show_ingestion_report(request, ingestionId):
    try: ing = Ingestion.objects.filter(id = ingestionId)[0]
    except:
        return HttpResponseNotFound('Ingestion report not found.')
    report = ing.report
    if report:
        report = str(zlib.decompress(base64.decodestring(ing.report)))
    else:
        report = 'No report found... maybe the processing is not finished yet?'

    menu_id = 'ing'
    return render_to_response( 'ingestion_report.html', {   
        'report'            : report, 
        'selected_entry_id' : menu_id, 
        'title'             : get_title_from_menu_id(menu_id),
    },
    context_instance = RequestContext(request))
示例#8
0
def home(request):
    """
    Related to ingestion step.
    This is a callback function (as defined in django's urls.py file).
    """

    insts = Instrument.objects.exclude(itt = None)
    q = Image.objects.all().count()
    menu_id = 'ing'
    return render_to_response('ingestion.html', {   
        'ingested'          : q, 
        'selected_entry_id' : menu_id, 
        'title'             : get_title_from_menu_id(menu_id),
        # Available ITTs (Instrument Translation Tables)
        'itranstables'      : [inst.name for inst in insts],
    }, 
    context_instance = RequestContext(request))
示例#9
0
def single_result(request, pluginId, taskId):
    """
    Same content as the page displayed by related plugin.
    """
    plugin = manager.getPluginByName(pluginId)
    if not plugin:
        return HttpResponseNotFound("""<h1><span style="color: red;">Invalid URL. Result not found.</h1></span>""")

    try:
        task = Processing_task.objects.filter(id = int(taskId))[0]
    except IndexError:
        # TODO: set a better page for that
        return HttpResponseNotFound("""<h1><span style="color: red;">Result not found.</h1></span>""")

    menu_id = 'results'
    return render_to_response( 'single_result.html', {  
        'pid'               : pluginId, 
        'tid'               : taskId,
        'selected_entry_id' : menu_id, 
        'plugin'            : plugin,
        'title'             : get_title_from_menu_id(menu_id),
    }, 
    context_instance = RequestContext(request))
示例#10
0
文件: pref.py 项目: gotsunami/Youpi
def home(request):
	"""
	Preferences template
	"""
	import ConfigParser
	config = ConfigParser.RawConfigParser()

	# Looks for themes
	theme_dirs = glob.glob(os.path.join(settings.MEDIA_ROOT, 'themes', '*'))
	themes = []

	for dir in theme_dirs:
		try:
			config.read(os.path.join(dir, 'META'))
		except:
			# No META data, theme not conform
			pass

		if not os.path.isfile(os.path.join(dir, 'screenshot.png')):
			# No screenshot available, theme not conform
			continue

		themes.append({	'name' 			: config.get('Theme', 'Name'),
						'author' 		: config.get('Theme', 'Author'),
						'author_uri'	: config.get('Theme', 'Author URI'),
						'description' 	: config.get('Theme', 'Description'),
						'version' 		: config.get('Theme', 'Version'),
						'short_name'	: os.path.basename(dir),
						})

	for k in range(len(themes)):
		if themes[k]['short_name'] == request.user.get_profile().guistyle:
			break

	policies = CondorNodeSel.objects.filter(is_policy = True).order_by('label')
	selections = CondorNodeSel.objects.filter(is_policy = False).order_by('label')
	try:
		p = request.user.get_profile()
		config = marshal.loads(base64.decodestring(str(p.dflt_condor_setup)))
	except EOFError:
		config = None

	# Global permissions (non data related)
	user = request.user
	glob_perms = [
		['Can submit jobs on the cluster', 			'youpi.can_submit_jobs'],
		['Can view ingestion logs', 				'youpi.can_view_ing_logs'],
		['Can add tags', 							'youpi.add_tag'],
		['Can monitor running jobs on the cluster', 'youpi.can_monitor_jobs'],
		['Can view processing results', 			'youpi.can_view_results'],
		['Can grade qualityFITSed images', 			'youpi.can_grade'],
		['Can generate reports', 					'youpi.can_use_reporting'],
		['Can run a software version check', 		'youpi.can_run_softvc'],
		['Can add custom policy or selection', 		'youpi.add_condornodesel'],
		['Can delete custom policy or selection', 	'youpi.delete_condornodesel'],
		['Can change custom Condor requirements', 	'youpi.can_change_custom_condor_req'],
	]
	# Adds can_use_plugin_* permissions, generated on-the-fly by the checksetup script
	perms = Permission.objects.filter(codename__startswith = 'can_use_plugin_')
	for pperm in perms:
		glob_perms.append([pperm.name, 'youpi.' + pperm.codename])

	menu_id = 'preferences'
	return render_to_response('preferences.html', {	
						'themes'			: themes,
						'plugins' 			: manager.plugins, 
						'current_theme'		: themes[k],
						'policies'			: policies,
						'selections'		: selections,
						'config'			: config,
						'selected_entry_id'	: menu_id, 
						'title' 			: get_title_from_menu_id(menu_id),
						'global_perms'		: [{'label': p[0], 'perm': user.has_perm(p[1])} for p in glob_perms],
					}, 
					context_instance = RequestContext(request))