Package com.sun.grid.jgdi.monitoring.filter

Examples of com.sun.grid.jgdi.monitoring.filter.ResourceFilter


    }

    //TODO LP: Add correct exitCodes
    private QHostOptions parse(List<String> argList) throws Exception {
        ResourceAttributeFilter resourceAttributeFilter = null;
        ResourceFilter resourceFilter = null;
        boolean showQueues = false;
        boolean showJobs = false;
        boolean showAsXML = false;
        UserFilter userFilter = null;
        HostFilter hostFilter = null;

        while (!argList.isEmpty()) {
            String arg = argList.remove(0);

            if (arg.equals("-help")) {
                out.println(getUsage());
                return null;
            } else if (arg.equals("-h")) {
                if (argList.isEmpty()) {
                    err.println("error: ERROR! -h option must have argument");
                    return null;
                }
                arg = argList.remove(0);
                //TODO LP: Qmaster should check if the value exists and is correct not the client
                //E.g.: qhost -h dfds -> qmaster should try to resolve the host a return error message
                hostFilter = HostFilter.parse(arg);
            } else if (arg.equals("-F")) {
                if (!argList.isEmpty()) {
                    arg = argList.get(0);
                    // we allow only a comma separated arg string
                    // qhost CLI allows also whitespace separated arguments
                    if (!arg.startsWith("-")) {
                        arg = argList.remove(0);
                        resourceAttributeFilter = ResourceAttributeFilter.parse(arg);
                    } else {
                        resourceAttributeFilter = new ResourceAttributeFilter();
                    }
                } else {
                    resourceAttributeFilter = new ResourceAttributeFilter();
                }
            } else if (arg.equals("-j")) {
                showJobs = true;
            } else if (arg.equals("-l")) {
                if (argList.isEmpty()) {
                    err.println("error: ERROR! -l option must have argument");
                    return null;
                }
                resourceFilter = new ResourceFilter();
                arg = argList.remove(0);
                try {
                    //TODO LP: Qmaster should check if the value exists and is correct not the client
                    //E.g.: qhost -l bal=34 -> qmaster should say bla does not exist
                    //E.g.: qhost -l swap_total -> qmaster - no value to swap_total
View Full Code Here


    public void testResourceFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            ClusterQueueSummaryOptions options = new ClusterQueueSummaryOptions();
            ResourceFilter rsf = new ResourceFilter();
            rsf.addResource("NoAccessUsers", "lx-x86");
            options.setResourceFilter(rsf);
            List<ClusterQueueSummary> result = jgdi.getClusterQueueSummary(options);
            printResult(result);
        } finally {
            jgdi.close();
View Full Code Here

        }
    }
   
    private QQuotaOptions parse(String[] args) throws Exception {
        ResourceAttributeFilter resourceAttributeFilter = null;
        ResourceFilter resourceFilter = null;
        UserFilter userFilter = null;
        HostFilter hostFilter = null;
        ProjectFilter projectFilter = null;
        ParallelEnvironmentFilter peFilter = null;
        QueueFilter queueFilter = null;
       
        LinkedList<String> argList = new LinkedList<String>();
        for (int i = 0; i < args.length; i++) {
            argList.add(args[i]);
        }
       
        while (!argList.isEmpty()) {
            String arg = (String) argList.removeFirst();
           
            if (arg.equals("-help")) {
                out.println(getUsage());
                return null;
            } else if (arg.equals("-h")) {
                if (argList.isEmpty()) {
                    throw new IllegalArgumentException("missing host_list");
                }
                arg = (String) argList.removeFirst();
                hostFilter = HostFilter.parse(arg);
            } else if (arg.equals("-l")) {
                if (argList.isEmpty()) {
                    throw new IllegalArgumentException("missing resource_list");
                }
                resourceFilter = new ResourceFilter();
                arg = (String) argList.removeFirst();
                resourceFilter = ResourceFilter.parse(arg);
            } else if (arg.equals("-u")) {
                if (argList.isEmpty()) {
                    throw new IllegalArgumentException("missing user_list");
View Full Code Here

    }
   
// [-l resource_list]                       request the given resources
    @OptionAnnotation(value = "-l", extra = OptionAnnotation.MAX_ARG_VALUE)
    public void setResourceList(final OptionInfo oi) throws JGDIException {
        ResourceFilter resourceList = ResourceFilter.parse(oi.getArgsAsString());
        @SuppressWarnings(value = "unchecked")
        Set<String> names = resourceList.getResourceNames();
        for (String name : names) {
            ComplexEntry ce = new ComplexEntryImpl(name);
            ce.setStringval(resourceList.getResource(name));
            if (hard) {
                job.addHardResource(ce);
            } else {
                job.addSoftResource(ce);
            }
View Full Code Here

        throw new AbortException();
    }
    //[-l resource_list]                       request the given resources
    @OptionAnnotation(value="-l",extra=OptionAnnotation.MAX_ARG_VALUE)
    public void setResourceList(final OptionInfo oi) throws JGDIException {
        ResourceFilter resourceList =  ResourceFilter.parse(oi.getArgsAsString());
        @SuppressWarnings("unchecked")
        Set<String> names = resourceList.getResourceNames();
        for(String name: names){
            ComplexEntry ce = new ComplexEntryImpl(name);
            ce.setStringval(resourceList.getResource(name));
            ar.addResource(ce);
        }
        oi.optionDone();
    }
View Full Code Here

TOP

Related Classes of com.sun.grid.jgdi.monitoring.filter.ResourceFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.