Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[geclipse-dev] Problems with code of Romain

Hello Romain

I have a problem submitting a job to gilda have you tried your code with gilda? Here are my settings and code I use:
    try {
                System.out.print("Start submitting a job");
                VomsVoCreator crea = new VomsVoCreator();
                crea.setVoHost("voms.ct.infn.it");
                crea.setVoPort(15001);
                crea.setVoHostDN("/C=IT/O=INFN/OU=Host/L=Catania/CN=voms.ct.infn.it");
                crea.setVoInfoService(URI.create("ldap://glite-rb.ct.infn.it:2170";));
                crea.setVoName("gilda");
                VomsVirtualOrganization biomed = new VomsVirtualOrganization();
                crea.apply(biomed);
                IGridJobService[] jss =  biomed.getJobSubmissionServices( null );
                IWorkspace ws = ResourcesPlugin.getWorkspace();
                IWorkspaceRoot swRoot = ws.getRoot();
                IProject project = swRoot.getProject( "myproject" );
                if ( ! project.exists() ) {


                        project.create( null );
                }
    
                project.open( null );
    
                IFolder jsdlFolder = project.getFolder("jsdl");
    
                if(!jsdlFolder.exists()) {
                        jsdlFolder.create(true,true,null);
                }
    
                IFolder jobsFolder = project.getFolder("jobs");
    
                if(!jobsFolder.exists()) {
                        jobsFolder.create(true,true,null);
                }
    
                IFile file = jsdlFolder.getFile( "myjsld.jsdl" );
    
                if(!file.exists()){             
                        FileOutputStream tempOutStream= new FileOutputStream(file.getRawLocation().toOSString());
                        tempOutStream.close();
    
                        FileInputStream tempInStream = new FileInputStream(file.getRawLocation().toOSString());
                        file.create( tempInStream, true, null );
                        tempInStream.close();
                }
    
                JSDLJobDescription jsdl = null;
                IGridElement element = GridModel.getRoot().findElement( file );
    
                if (element instanceof JSDLJobDescription){
                        jsdl = ( JSDLJobDescription )element;
                }
    
                jsdl.createRoot();
                jsdl.addJobDescription();
                jsdl.addApplication();
    
                jsdl.addPOSIXApplicationDetails("hostname", "/bin/echo", null, null, null, null, null, null);
                jsdl.addArgument("Coucou");
                jsdl.save(file);
    
                final String EUGRIDPMA_NAME = "European Policy Management Authority for Grid Authentication";
    
                ExtensionManager manager = new ExtensionManager();
                List< IConfigurationElement > elements = manager.getConfigurationElements(
                                Extensions.CA_CERT_LOADER_POINT,
                                Extensions.CA_CERT_LOADER_ELEMENT
                );
    
                ICaCertificateLoader loader = null;
                for ( IConfigurationElement elt : elements ) {
                        String name = elt.getAttribute(
                                        Extensions.CA_CERT_LOADER_NAME_ATTRIBUTE );
                        if ( EUGRIDPMA_NAME.equals( name ) ) {
                                loader = ( ICaCertificateLoader ) elt.createExecutableExtension(
                                                Extensions.CA_CERT_LOADER_CLASS_ATTRIBUTE );
                                break;
                        }
                }
    
                ICaCertificate[] certs = null;
                if ( loader != null ) {
                        URI[] uris = loader.getPredefinedRemoteLocations();
                        if ( ( uris != null ) && ( uris.length > 0 ) ) {
                                String[] certnames = loader.getCertificateList( uris[ 0 ], null );
                                if ( certnames != null ) {
                                        certs = new ICaCertificate[ certnames.length ];
                                        for ( int i = 0 ; i < certnames.length ; i++ ) {
                                                certs[ i ] = loader.getCertificate( uris[ 0 ], certnames[ i ], null );
                                        }
                                }
                        }
                }
    
                CaCertManager.getManager().addCertificates(certs);
           
    
                VomsProxyDescription desc = new VomsProxyDescription (
                                new IVirtualOrganization[] { biomed },
                                new File("/home/pod/.globus/gildausercert.pem"),
                                new File("/home/pod/.globus/gildauserkey.pem")
    
                );
    
               // desc.addFqan(FullyQualifiedAttributeName.getFqan(biomed, new String[] {"lcg1"}, null));
    
                PasswordManager.registerPassword("/home/pod/.globus/gildauserkey.pem", "password");
                desc.setLifetime( 86400 ); // In second, so one day here
    
                VomsProxy proxy = ( VomsProxy ) AuthenticationTokenManager.getManager().createToken( desc );
    
    
                if ( ! proxy.isValid() ) {
                        proxy.validate( new NullProgressMonitor() );
                }
                if ( ! proxy.isActive() ) {
                        proxy.setActive( true, null );
                        System.out.println("Proxy has been activated");
                }
    
                AuthenticationTokenManager.getManager().setDefaultToken(proxy);
    
                
                AuthTokenRequest req = new AuthTokenRequest(desc,"","");
                IAuthenticationToken tok = CoreAuthTokenProvider.staticRequestToken(req);
    
    
                IGridJob job = null;
    
                for(IGridJobService js : jss) {
                        if(((Object) js).canSubmit(jsdl)) {
                    System.out.println(js.getName());
                                try{
                                        IGridJobID id = js.submitJob(jsdl, new NullProgressMonitor());
                                        job = GridJob.createJobStructure(jobsFolder, (GridJobID) id, js, jsdl, "test");
                                        break;
                                }
                                catch(ProblemException e) {
                                        e.printStackTrace();
                                }
    
                       }
                }
    
                
                while( job.getJobStatus().canChange() ) {
                        try {
                                Thread.sleep(5000);
                                job.updateJobStatus();
                                System.out.println(job.getJobStatus().getName() + ": " + job.getJobStatus().getReason());
                        } catch (InterruptedException e) {
                                e.printStackTrace();
                        }
                }
    
                long duration = (System.currentTimeMillis() - job.getSubmissionTime().getTime()) / 1000;
                
                System.out.println( duration + " s for executing a 'hello world' !!!! That's HPC !!!" );
    
                
        } catch (GridModelException e) {
                e.printStackTrace();
        } catch (CoreException e) {
                e.printStackTrace();
        }
        catch (IOException e) {
                e.printStackTrace();
        }
    
    
    and I get the follwing exception.
    
    Start submitting a job
    Proxy has been activated
    WMS @ https://glite-rb3.ct.infn.it:7443/glite_wms_wmproxy_server
    eu.geclipse.core.reporting.ProblemException: Job submission failed
        at eu.geclipse.glite.WMSClient.submit(WMSClient.java:462)
        at eu.geclipse.glite.WMSClient.submitJob(WMSClient.java:574)
        at eu.geclipse.glite.resources.GliteJobAPI.submitJob(GliteJobAPI.java:113)
        at eu.geclipse.glite.resources.GliteJobService.submitJob(GliteJobService.java:66)
        at reullion.Application.run(Application.java:198)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:572)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:171)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
    eu.geclipse.core.reporting.ProblemException[-1049879000]: java.security.GeneralSecurityException: Authentication token could not be created
        at eu.geclipse.glite.WMSClient.delegateProxy(WMSClient.java:225)
        at eu.geclipse.glite.WMSClient.submit(WMSClient.java:347)
        at eu.geclipse.glite.WMSClient.submitJob(WMSClient.java:574)
        at eu.geclipse.glite.resources.GliteJobAPI.submitJob(GliteJobAPI.java:113)
        at eu.geclipse.glite.resources.GliteJobService.submitJob(GliteJobService.java:66)
        at reullion.Application.run(Application.java:198)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:572)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:171)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
    





    Eclipse also complains about this if statement
        //  if(js.canSubmit(jsdl)) {
    
                       //}
    Eclipse says:  The Method canSubmit(JSDLJobDescription) is undefined for the type IGridJobService
    So i just dont use this if statement. do you
    




    And can you explain me for what purpose you need this I guess its not necessary?:
      // desc.addFqan(FullyQualifiedAttributeName.getFqan(biomed, new String[] {"lcg1"}, null));
    
    thx pod
    
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


Back to the top