Tripal
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Drupal\tripal_chado\Task\ChadoInstaller Class Reference
Inheritance diagram for Drupal\tripal_chado\Task\ChadoInstaller:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal_chado\Task\ChadoInstaller:
Collaboration graph
[legend]

Public Member Functions

 validateParameters ()
 
 performTask ()
 
 getProgress ()
 
 getStatus ()
 
- Public Member Functions inherited from Drupal\tripal_chado\Task\ChadoTaskBase
 getTripalDbxClass ($class)
 
- Public Member Functions inherited from Drupal\tripal_biodb\Task\BioTaskBase
 __construct (?\Drupal\Core\Database\Connection $database=NULL, ?\Psr\Log\LoggerInterface $logger=NULL, ?\Drupal\tripal_biodb\Lock\SharedLockBackendInterface $locker=NULL, ?\Drupal\Core\State\StateInterface $state=NULL)
 
 setParameters (array $parameters=[])
 
 getId ()
 
 getLogger ()
 

Public Attributes

const TASK_NAME = 'installer'
 
const DEFAULT_CHADO_VERSION = '1.3'
 
- Public Attributes inherited from Drupal\tripal_chado\Task\ChadoTaskBase
const TASK_NAME = 'chado'
 
- Public Attributes inherited from Drupal\tripal_biodb\Task\BioTaskBase
const TASK_NAME = 'task'
 
const STATE_KEY_DATA_PREFIX = 'tripal_biodb_'
 

Protected Attributes

 $installNumChunks
 
- Protected Attributes inherited from Drupal\tripal_biodb\Task\BioTaskBase
 $id
 
 $connection
 
 $logger
 
 $locker
 
 $state
 
 $parameters = ['input_schemas' => [], 'output_schemas' => [], ]
 
 $inputSchemas = []
 
 $outputSchemas = []
 

Additional Inherited Members

- Protected Member Functions inherited from Drupal\tripal_biodb\Task\BioTaskBase
 prepareSchemas (array $schema_list)
 
 getSchemaLockName (\Drupal\tripal\TripalDBX\TripalDbxConnection $db)
 
 initId ()
 
 acquireTaskLocks ()
 
 releaseTaskLocks ()
 

Detailed Description

Chado installer.

Usage:

// Where 'chado' is the name of the Chado schema to instantiate.
$installer = \Drupal::service('tripal_chado.installer');
$installer->setParameters([
'output_schemas' => ['chado'],
'version' => '1.3',
]);
if (!$installer->performTask()) {
// Display a message telling the user the task failed and details are in
// the site logs.
}

Member Function Documentation

◆ getProgress()

Drupal\tripal_chado\Task\ChadoInstaller::getProgress ( )

{Returns the percent of progress of current task.This method can also be used to check if a task is currently running if it has a > 0 value. A negative value means an error occured while running.

Returns
float A value between -1 and 1, 0 meaning the task has not been started yet, 1 meaning the task is completed with success and a negative value meaning that the task failed. The negative value may be used as a code to identify the error.
}

Implements Drupal\tripal_biodb\Task\BioTaskInterface.

◆ getStatus()

Drupal\tripal_chado\Task\ChadoInstaller::getStatus ( )

{{Returns a string describing current status of the performed task.This function returns the last known status, even if the task ended. In case of failure, this function may return the reason of the failure.

Returns
string A localized description.
}}

Reimplemented from Drupal\tripal_biodb\Task\BioTaskBase.

◆ performTask()

Drupal\tripal_chado\Task\ChadoInstaller::performTask ( )

Installs a given chado schema version into the specified schema.

The install procedure uses a set of SQL files.

Task parameter array provided to the class constructor includes:

  • 'output_schemas' array: one output schema that must not exist (required)
  • 'input_schemas' array: no input schema
  • 'version' string: a version number (optional, default to ::DEFAULT_CHADO_VERSION)

Example:

['output_schemas' => ['chado'], 'version' => '1.3']
Returns
bool TRUE if the task was performed with success and FALSE if the task was completed but without the expected success.
Exceptions
Drupal

Reimplemented from Drupal\tripal_biodb\Task\BioTaskBase.

◆ validateParameters()

Drupal\tripal_chado\Task\ChadoInstaller::validateParameters ( )

Validate task parameters.

Parameter array provided to the class constructor must include one output schema and it may include a version number:

['output_schemas' => ['chado'], 'version' => '1.3']
Exceptions

Implements Drupal\tripal_biodb\Task\BioTaskInterface.

Member Data Documentation

◆ $installNumChunks

Drupal\tripal_chado\Task\ChadoInstaller::$installNumChunks
protected
Initial value:
= [
'1.3' => 41,
]

The number of chunk files per version we can install.

Todo:
: We should use one single SQL file.

◆ DEFAULT_CHADO_VERSION

const Drupal\tripal_chado\Task\ChadoInstaller::DEFAULT_CHADO_VERSION = '1.3'

Default version.

◆ TASK_NAME

const Drupal\tripal_chado\Task\ChadoInstaller::TASK_NAME = 'installer'

Name of the task.


The documentation for this class was generated from the following file: