Skip to end of metadata
Go to start of metadata

Target Audience

  • The following instructions apply to users who want to make use of the JobScheduler API Interface in their Perl scripts.
    • The Perl support of the JobScheduler engine should be configured for the Perl release that is operated in your environment.

    • Currently JobScheduler comes with support for Perl release 5.18.2 (http://www.sos-berlin.com/jira/browse/JS-1096).

  • Perl support for the JobScheduler API is not required if you just wanted to run existing Perl scripts with JobScheduler. In that case Perl scripts are executed in the same way as any shell scripts, see How can I create a simple shell job? 

Prerequisites on Linux

The JobScheduler needs a library ./lib/libsosperlscript.<perl-version>.so that is included in the setup.

Since JobScheduler release 1.6.4043 the library ./lib/libsosperlscript.5.18.2.so is included that is compiled with Perl 5.18.2.

This library works with Perl versions 5.12.x, 5.14.x, 5.16.x too.

32Bit JobScheduler

  1. You have to install a 32Bit Perl or a 64Bit Perl
  2. Create 2 symlinks in the ./lib directory of the JobScheduler installation
    1. The first symlink with the name libperl.so has to point to the 32Bit Perl interpreter libperl.so of the Perl installation
    2. The second symlink with the name libsosperlscript.so has to point to the ./lib/libsosperlscript.<perl-version>.so.

In the ./lib directory of the JobScheduler installation you will find the following libsosperlscript.<perl-version>.so.

  • libsosperlscript.5.18.2.so
  • libsosperlscript.5.14.0.so (deprecated)
  • libsosperlscript.5.12.0.so (deprecated)
  • libsosperlscript.5.10.0.so (deprecated)
  • libsosperlscript.5.8.8.so (deprecated)

For example, assumed that you have a Perl installation with version 5.12.3 and the 32Bit libraries are located in /usr/lib/perl5.
Then navigate to the ./lib directory of the JobScheduler installation and create the following symlinks:

 > ln -s /usr/lib/perl5/5.12.3/i586-linux-thread-multi/CORE/libperl.so libperl.so
 > test -f libsosperlscript.so && rm libsosperlscript.so
 > ln -s libsosperlscript.5.12.0.so libsosperlscript.so

Since JobScheduler Release 1.6.4043 you have to make the second symlink point to libsosperlscript.5.18.2.so.

 > ln -s libsosperlscript.5.18.2.so libsosperlscript.so

Otherwise you will receive an error like

 [ERROR]  COM-80020009  DISP_E_EXCEPTION [begin] [] [COM-800401F8  CO_E_DLLNOTFOUND [CoGetClassObject] [perlScript], in Remote_module_instance_server::begin], method=call
 [info]   dlopen("libsosperlscript.so"): /install/path/of/jobscheduler/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /install/path/of/jobscheduler/lib/libsosperlscript.so)

64Bit JobScheduler

  1. You have to install a 64Bit Perl
  2. Create 2 symlinks in the ./lib directory of the JobScheduler installation
    1. The first symlink with the name libperl.so has to point to the 64Bit Perl interpreter libperl.so of the Perl installation
    2. The second symlink with the name libsosperlscript.so has to point to the ./lib/libsosperlscript.<perl-version>.so.

In the ./lib directory of the JobScheduler installation you will find the following libsosperlscript.<perl-version>.so.

  • libsosperlscript.5.18.2.so
  • libsosperlscript.5.8.8.so (deprecated)

For example you have a Perl installation with version 5.12.3 and the 64Bit libraries are located in /usr/lib/perl5.
Then navigate to the ./lib directory of the JobScheduler installation and create the following symlinks:

 > ln -s /usr/lib/perl5/5.12.3/x86_64-linux-thread-multi/CORE/libperl.so libperl.so
 > test -f libsosperlscript.so && rm libsosperlscript.so
 > ln -s libsosperlscript.5.18.2.so libsosperlscript.so

Set $PERL5LIB

The libsosperlscript.<perl-version>.so library sets the @INC variable from the environment where libsosperlscript.<perl-version>.so was compiled.
This could be different from your own Perl environment. In such cases you can use

   perl -e 'print join "\n", @INC'

to get the content of @INC of your own Perl environment.

JobScheduler (e.g. for libsosperlscript.5.18.2.so) comes with the following content of @INC

  /usr/local/perl-5.18.2/lib/site_perl/5.18.2/i686-linux-thread-multi
  /usr/local/perl-5.18.2/lib/site_perl/5.18.2
  /usr/local/perl-5.18.2/lib/5.18.2/i686-linux-thread-multi
  /usr/local/perl-5.18.2/lib/5.18.2
  .

You can test it with a JobScheduler job like

  <job>
    <script language="perlScript">
    <![CDATA[
        
#!/usr/bin/perl
print join "\n", @INC;
        
    ]]>

   </script>
   <run_time/>
  </job>

You have to set the PERL5LIB environment variable for the JobScheduler if the @INC environment variable shows some different content.
For this edit the ./user_bin/jobscheduler_environment_varibales.sh with

  export PERL5LIB=`perl -e 'print join ":", @INC'`

See the article How to add environment variables for all jobs for more information how you change the environment of the JobScheduler.

Prerequisites on Windows

You have to install an current ActivePerl with 32Bit or 64Bit as for the JobScheduler release.

Job Example

Now you can test the JobScheduler Perl- PI with e.g. the following job:

<job>
	<script language="perlScript">
	<![CDATA[
		sub spooler_init {
    			my $rc = 1;
    
    			$spooler_log->info("spooler_init");  
    
    			return $rc;
  		}

  		sub spooler_process {
    			my $rc = 1;
    
    			$spooler_log->info("spooler_process");
    			$spooler_log->info($spooler_job->name . " is running"); 

    			return signal_return($rc);
  		}
  			
  		sub spooler_exit {
     			$spooler_log->info("spooler_exit"); 
  		}
  			
  		###################################################
  		# This method provides that the method   
  		# spooler_process is called only for one time.
  		#
  		# Standalone Jobs: 
  		# JobScheduler continues calling the spooler_process 
  		# method until it returns 0.
  		#  
  		# Order Jobs in a Job Chain: 
  		# The Order acquires the next node in the Job Chain 
  		# if spooler_process returns 1
  		# and the error node if spooler_process returns 0
  		#
  		# see http://www.sos-berlin.com/doc/en/scheduler.doc/api/Job_impl-perl.xml#method__spooler_process
  		###################################################
  		sub signal_return {
    			my ($rc) = @_;
    			if(defined($spooler_task->order)) { #is an Order Job
    	 			return $rc;
    			}
    			return 0;
  		}
  			
        ]]>
	</script>
	<run_time/>
</job>

For more information about the JobScheduler API see http://www.sos-berlin.com/doc/en/scheduler.doc/api/api-perl.xml

 

Write a comment…