$darkmode
DENOPTIM
|
Task structure for any of the main programs in the denoptim project, such as genetic algorithm and combinatorial exploration of fragment spaces. More...
Public Member Functions | |
ProgramTask (File configFile, File workDir) | |
Creates and configures the program task. More... | |
Object | call () |
This method redirects the callable functionality to an abstract method (namely ProgramTask#runProgram() ) to be specified by the implementations of this abstract class. More... | |
void | printErrorToFile () |
Method that can be called to create a text file with the error triggered by any Throwable that can be thrown by the execution of the program. More... | |
Public Member Functions inherited from denoptim.task.Task | |
Task (final int id) | |
int | getId () |
void | setVerbosity (int verbosity) |
Set the verbosity: i.e., amount of log printed by this class. More... | |
void | setWorkSpace (File workDir) |
Sets the pathname of the work space, i.e., the location where the task is supposed to use move to or to threat as the result of "pwd" at runtime. More... | |
boolean | isCompleted () |
boolean | foundException () |
Throwable | getException () |
String | getErrorMessage () |
void | stopTask () |
Stop the task if not already completed. More... | |
String | toString () |
Returns a string identifying this task by its ID and reporting whether an exception has been thrown and if the tasks is completed. More... | |
void | setNotify (boolean notify) |
Protected Member Functions | |
void | handleThrowable () |
Method to handle any Throwable originated from the runProgram() method. More... | |
void | stopLogger () |
Stops the program-specific logger and releases the lock file on the logfile. More... | |
abstract void | runProgram () throws Throwable |
Protected Attributes | |
File | configFilePathName |
File containing configuration parameters for the program task. More... | |
String | loggerIdentifier = "none" |
Identifier of this program's logger. More... | |
Protected Attributes inherited from denoptim.task.Task | |
boolean | notifyGlobalTaskManager = false |
Flag controlling whether this task is expected to notify the static task manager. More... | |
boolean | completed = false |
Flag about completion. More... | |
boolean | hasException = false |
Flag about exception. More... | |
String | errMsg = "" |
Error message produced by any subtask. More... | |
Throwable | thrownExc |
Exception thrown. More... | |
int | id |
A user-assigned id for this task. More... | |
ProcessHandler | processHandler |
Executor for external bash script. More... | |
File | workDir |
The file system location where we want to be placed when doing the work. More... | |
int | verbosity = 0 |
Verbosity level. More... | |
final String | SEP = System.getProperty("file.separator") |
System-dependent file separator. More... | |
final String | NL = System.getProperty("line.separator") |
System-dependent line separator (newline) More... | |
Additional Inherited Members | |
Public Attributes inherited from denoptim.task.Task | |
Object | lock = new Object() |
Lock for addressing synchronization issues. More... | |
Task structure for any of the main programs in the denoptim project, such as genetic algorithm and combinatorial exploration of fragment spaces.
Any implementation of this class must define a runProgram()
method that runs the actual program implementation.
Definition at line 43 of file ProgramTask.java.
denoptim.task.ProgramTask.ProgramTask | ( | File | configFile, |
File | workDir | ||
) |
Creates and configures the program task.
configFile | the file containing the configuration parameters. |
workDir | the file system location from which to run the program. |
Definition at line 62 of file ProgramTask.java.
References denoptim.utils.TaskUtils.getUniqueTaskIndex(), denoptim.task.Task.id, denoptim.task.ProgramTask.loggerIdentifier, and denoptim.task.Task.workDir.
Object denoptim.task.ProgramTask.call | ( | ) |
This method redirects the callable functionality to an abstract method (namely ProgramTask#runProgram()
) to be specified by the implementations of this abstract class.
Definition at line 78 of file ProgramTask.java.
References denoptim.logging.StaticLogger.appLogger, denoptim.task.ProgramTask.configFilePathName, denoptim.task.ProgramTask.handleThrowable(), denoptim.task.ProgramTask.loggerIdentifier, denoptim.task.Task.notifyGlobalTaskManager, denoptim.task.ProgramTask.runProgram(), denoptim.task.StaticTaskManager.subtractDoneTask(), denoptim.task.Task.thrownExc, and denoptim.task.Task.workDir.
|
protected |
Method to handle any Throwable
originated from the runProgram()
method.
This method can be overwritten to alter the behavior in case of specific needs.
Reimplemented in denoptim.programs.combinatorial.FragSpaceExplorer, denoptim.programs.denovo.GARunner, denoptim.programs.fitnessevaluator.FitnessRunner, and denoptim.programs.fragmenter.Fragmenter.
Definition at line 109 of file ProgramTask.java.
References denoptim.task.ProgramTask.printErrorToFile(), and denoptim.task.ProgramTask.stopLogger().
Referenced by denoptim.task.ProgramTask.call().
void denoptim.task.ProgramTask.printErrorToFile | ( | ) |
Method that can be called to create a text file with the error triggered by any Throwable
that can be thrown by the execution of the program.
The file names "ERROR" will be created in the working directory specified to this ProgramTask
.
Definition at line 138 of file ProgramTask.java.
References denoptim.files.FileUtils.addToRecentFiles(), denoptim.logging.StaticLogger.appLogger, denoptim.task.ProgramTask.loggerIdentifier, denoptim.task.Task.SEP, denoptim.task.Task.thrownExc, denoptim.files.FileFormat.TXT, denoptim.task.Task.workDir, and denoptim.io.DenoptimIO.writeData().
Referenced by denoptim.task.ProgramTask.handleThrowable().
|
abstractprotected |
Reimplemented in denoptim.programs.combinatorial.FragSpaceExplorer, denoptim.programs.denovo.GARunner, denoptim.programs.fitnessevaluator.FitnessRunner, denoptim.programs.fragmenter.Fragmenter, denoptim.programs.genetweeker.GeneOpsRunner, denoptim.programs.grapheditor.GraphEditor, denoptim.programs.graphlisthandler.GraphListsHandler, denoptim.programs.isomorphism.Isomorphism, and denoptim.programs.moldecularmodelbuilder.MolecularModelBuilder.
Referenced by denoptim.task.ProgramTask.call().
|
protected |
Stops the program-specific logger and releases the lock file on the logfile.
Definition at line 121 of file ProgramTask.java.
References denoptim.task.ProgramTask.loggerIdentifier.
Referenced by denoptim.task.ProgramTask.handleThrowable(), denoptim.programs.denovo.GARunner.runProgram(), and denoptim.programs.fragmenter.Fragmenter.runProgram().
|
protected |
File containing configuration parameters for the program task.
Definition at line 48 of file ProgramTask.java.
Referenced by denoptim.task.ProgramTask.call(), denoptim.programs.combinatorial.FragSpaceExplorer.runProgram(), denoptim.programs.denovo.GARunner.runProgram(), denoptim.programs.fitnessevaluator.FitnessRunner.runProgram(), denoptim.programs.fragmenter.Fragmenter.runProgram(), denoptim.programs.genetweeker.GeneOpsRunner.runProgram(), denoptim.programs.grapheditor.GraphEditor.runProgram(), denoptim.programs.graphlisthandler.GraphListsHandler.runProgram(), denoptim.programs.isomorphism.Isomorphism.runProgram(), and denoptim.programs.moldecularmodelbuilder.MolecularModelBuilder.runProgram().
|
protected |
Identifier of this program's logger.
Definition at line 53 of file ProgramTask.java.
Referenced by denoptim.task.ProgramTask.call(), denoptim.task.ProgramTask.printErrorToFile(), denoptim.task.ProgramTask.ProgramTask(), denoptim.programs.combinatorial.FragSpaceExplorer.runProgram(), denoptim.programs.denovo.GARunner.runProgram(), denoptim.programs.fitnessevaluator.FitnessRunner.runProgram(), denoptim.programs.fragmenter.Fragmenter.runProgram(), denoptim.programs.genetweeker.GeneOpsRunner.runProgram(), denoptim.programs.grapheditor.GraphEditor.runProgram(), denoptim.programs.graphlisthandler.GraphListsHandler.runProgram(), denoptim.programs.isomorphism.Isomorphism.runProgram(), denoptim.programs.moldecularmodelbuilder.MolecularModelBuilder.runProgram(), and denoptim.task.ProgramTask.stopLogger().