Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F88592324
PhabricatorWorkerManagementRetryWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Oct 19, 15:35
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Oct 21, 15:35 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21794720
Attached To
rPH Phabricator
PhabricatorWorkerManagementRetryWorkflow.php
View Options
<?php
final
class
PhabricatorWorkerManagementRetryWorkflow
extends
PhabricatorWorkerManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'retry'
)
->
setExamples
(
'**retry** --id __id__'
)
->
setSynopsis
(
pht
(
'Retry selected tasks which previously failed permanently or '
.
'were cancelled. Only archived tasks can be retried.'
))
->
setArguments
(
array_merge
(
array
(
array
(
'name'
=>
'repeat'
,
'help'
=>
pht
(
'Repeat tasks which already completed successfully.'
),
),
),
$this
->
getTaskSelectionArguments
()));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$tasks
=
$this
->
loadTasks
(
$args
);
$is_repeat
=
$args
->
getArg
(
'repeat'
);
foreach
(
$tasks
as
$task
)
{
if
(!
$task
->
isArchived
())
{
$console
->
writeOut
(
"**<bg:yellow> %s </bg>** %s
\n
"
,
pht
(
'ACTIVE'
),
pht
(
'%s is already in the active task queue.'
,
$this
->
describeTask
(
$task
)));
continue
;
}
$result_success
=
PhabricatorWorkerArchiveTask
::
RESULT_SUCCESS
;
if
(
$task
->
getResult
()
==
$result_success
)
{
if
(!
$is_repeat
)
{
$console
->
writeOut
(
"**<bg:yellow> %s </bg>** %s
\n
"
,
pht
(
'SUCCEEDED'
),
pht
(
'%s has already succeeded, and will not be repeated. '
.
'Use "--repeat" to repeat successful tasks.'
,
$this
->
describeTask
(
$task
)));
continue
;
}
}
$task
->
unarchiveTask
();
$console
->
writeOut
(
"**<bg:green> %s </bg>** %s
\n
"
,
pht
(
'QUEUED'
),
pht
(
'%s was queued for retry.'
,
$this
->
describeTask
(
$task
)));
}
return
0
;
}
}
Event Timeline
Log In to Comment