New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Task.pm in vendors/lib/FCM/Context – NEMO

source: vendors/lib/FCM/Context/Task.pm @ 10669

Last change on this file since 10669 was 10669, checked in by nicolasmartin, 5 years ago

Import latest FCM release from Github into the repository for testing

File size: 2.5 KB
Line 
1# ------------------------------------------------------------------------------
2# (C) British Crown Copyright 2006-17 Met Office.
3#
4# This file is part of FCM, tools for managing and building source code.
5#
6# FCM is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# FCM is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with FCM. If not, see <http://www.gnu.org/licenses/>.
18# ------------------------------------------------------------------------------
19use strict;
20use warnings;
21# ------------------------------------------------------------------------------
22package FCM::Context::Task;
23use base qw{FCM::Class::HASH};
24
25use constant {
26    ST_FAILED  => 'ST_FAILED',
27    ST_OK      => 'ST_OK',
28    ST_WORKING => 'ST_WORKING',
29};
30
31__PACKAGE__->class({
32    ctx      => {},
33    error    => {},
34    id       => '$',
35    elapse   => {isa => '$', default => 0},
36    state    => {isa => '$', default => ST_WORKING},
37});
38# ------------------------------------------------------------------------------
391;
40__END__
41
42=head1 NAME
43
44FCM::Context::Task
45
46=head1 SYNOPSIS
47
48    use FCM::Context::Task;
49    my $task = FCM::Context::Task->new(\%attrib);
50
51=head1 DESCRIPTION
52
53An instance of this class represents the generic context for a task for the
54L<FCM::Util->task_runner()|FCM::Util>. This class is a sub-class of
55L<FCM::Class::HASH|FCM::Class::HASH>.
56
57=head1 ATTRIBUTES
58
59=over 4
60
61=item ctx
62
63The specific context of the task, such as the inputs and the outputs.
64
65=item error
66
67If the task failed, the error/exception will be returned in this attribute.
68
69=item id
70
71The ID of the task.
72
73=item elapse
74
75The amount of time (in seconds) taken to run the task.
76
77=item state
78
79The state of the task. See L</CONSTANTS> for possible variables.
80
81=back
82
83=head1 CONSTANTS
84
85=over 4
86
87=item FCM::Context::Task->ST_FAILED
88
89A status to indicate that the task has failed.
90
91=item FCM::Context::Task->ST_OK
92
93A status to indicate that the task is completed successfully.
94
95=item FCM::Context::Task->ST_WORKING
96
97A status to indicate that the task is bing worked on.
98
99=back
100
101=head1 COPYRIGHT
102
103(C) Crown copyright Met Office. All rights reserved.
104
105=cut
Note: See TracBrowser for help on using the repository browser.