Skip to content
Laurent Jourdren edited this page Mar 26, 2015 · 2 revisions

The Context class

WARNING: This documentation is outdated and will soon be updated.

The Context class is a very useful class. It is throw this class that Step developer interact with the Eoulsan framework.

General services

  • Get the settings with getSettings()
  • Get the Eoulsan runtime object with getRuntime()
  • Get the logger with getLogger()

Information about the current job

The Context class offer many method to get information about the current job:

  • Get the creation of the context with getContextCreationTime()

  • Get a description of the current Workflow with getWorkflow()

  • Get the current step with getCurrentStep()

  • Get information about the current job:

  • job id with getJobId()

  • job description with getJobDescription()

  • job UUID with getJobUUID()

  • job environment with getJobEnvironment()

  • Get path for the current job:

  • job log file with getLogPathname()

  • job base directory with getBasePathname()

  • job output directory with getOutputPathname()

  • Get information about the parameter file:

  • name with getCommandName()

  • description with getCommandDescription()

  • author with getCommandAuthor()

  • Get the path of the job configuration file

  • Parameter file with getParameterPathname()

  • Design with getDesignPathname()

  • Jar with getJarPathname()

Access to the input and output DataFiles of a Step

It is the most used functionality of the Context object. To access to the DataFiles use the getInputDataFile() and getOutputDataFile()

// Get the input DataFile for a sample (from design object) and a DataFormat
DataFile fastqFile = context.getInputDataFile(DataFormats.READS_FASTQ, sample);

// Get the output DataFile for a sample (from design object) and a DataFormat
DataFile filteredFastqFile = context.getOutputDataFile(DataFormats.FILTERD_READS_FASTQ, sample);

getInputDataFile() and getOutputDataFile() check if the requested DataFormat is in the list of the input or output DataFormat define in getInputDataFormat() and getOutputDataFormat() of your Step class. If you want to bypass this check, you can use the following methods:


// Get a DataFile for a sample (from design object) and a DataFormat
DataFile fastqFile = context.getOtherDataFile(DataFormats.READS_FASTQ, sample);

// Get a DataFile for a sample (from design object) and a DataFormat
DataFile filteredFastqFile = context.getOtherDataFile(DataFormats.FILTERD_READS_FASTQ, sample);