-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtripal_galaxy.drush.inc
executable file
·109 lines (97 loc) · 2.84 KB
/
tripal_galaxy.drush.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* @file
* Contains function relating to drush-integration of this module.
*/
/**
* @defgroup tripal_drush Tripal Drush Integration @{ Contains function relating
* to drush-integration of various tripal modules.
* @}
*/
/**
* Implements hook_drush_help().
*/
function tripal_galaxy_drush_help($command) {
switch ($command) {
// phpcs:disable Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak
// phpcs:disable Squiz.PHP.NonExecutableCode.Unreachable
case 'trp-galaxy-invoke':
return dt('Launches pending galaxy jobs waiting in the queue.');
break;
case 'trp-galaxy-status':
return dt('Launches pending galaxy jobs waiting in the queue.');
break;
// phpcs:enable Squiz.PHP.NonExecutableCode.Unreachable
// phpcs:enable Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak
}
}
/**
* Implements hook_drush_command().
*/
function tripal_galaxy_drush_command() {
$items = array();
$items['trp-galaxy-invoke'] = array(
'description' => dt('Launches pending galaxy jobs waiting in the queue.'),
'examples' => array(
'Single Job' => 'drush trp-galaxy-invoke --submission=512',
),
'arguments' => array(),
'options' => array(
'submission' => dt('The submission ID of the workflow to run.'),
),
);
$items['trp-galaxy-status'] = array(
'description' => dt('Updates the status of galaxy jobs.'),
'examples' => array(
'Single Job' => 'drush trp-galaxy-status --submission=512',
),
'arguments' => array(),
'options' => array(
'submission' => dt('The submission ID of the workflow to run.'),
'force' => dt('Forces update of status for jobs that are already have a satus of Completed or Error.'),
),
);
return $items;
}
/**
* Function for 'trp-galaxy-invoke' command.
*/
function drush_tripal_galaxy_trp_galaxy_invoke() {
$sid = drush_get_option('submission');
if (!$sid) {
drush_error('Please provide a submission id (ie.g. --submission=512).');
}
drush_print('Launching workflow...');
try {
tripal_galaxy_invoke_webform_submission($sid);
drush_print('Done.');
}
catch (Exception $e) {
drush_set_error("Cannot launch workflow: " . $e->getMessage());
}
}
/**
* Function for 'trp-galaxy-status' command.
*/
function drush_tripal_galaxy_trp_galaxy_status() {
$sid = drush_get_option('submission');
$force = drush_get_option('force');
if (!$force) {
$force = FALSE;
}
else {
$force = TRUE;
}
if ($sid) {
drush_print('Updating status of workflow...');
tripal_galaxy_check_submission_status($sid, $force);
drush_print('Done.');
// drush_set_error('Please provide a submission id (ie.g.
// --submission=512).');.
}
else {
drush_print('Updating status of all workflows...');
tripal_galaxy_check_submission_status(FALSE, $force);
drush_print('Done.');
}
}