1JobDescription(3pm) User Contributed Perl Documentation JobDescription(3pm)
2
3
4
6 Globus::GRAM::JobDescription - GRAM Job Description
7 Globus::GRAM::DefaultHandlingJobDescription - GRAM Job Description with
8 relative path handling
9
11 use Globus::GRAM::JobDescription;
12
13 $hash = { executable => [ '/bin/echo' ], arguments => [ 'hello' ] };
14 $description = new Globus::GRAM::JobDescription($filename);
15 $description = new Globus::GRAM::JobDescription($hash);
16 $executable = $description->executable();
17 $description->add($new_attribute, $new_value);
18 $description->save();
19 $description->save($filename);
20 $description->print_recursive($file_handle);
21
23 This object contains the parameters of a job request in a simple object
24 wrapper. The object may be queried to determine the value of any RSL
25 parameter, may be updated with new parameters, and may be saved in the
26 filesystem for later use.
27
28 Methods
29 new Globus::GRAM::JobDescription($filename)
30 A JobDescription is constructed from a file consisting of a Perl
31 hash of parameter => array mappings. Every value in the Job
32 Description is stored internally as an array, even single literals,
33 similar to the way an RSL tree is parsed in C. An example of such a
34 file is
35
36 $description =
37 {
38 executable => [ '/bin/echo' ],
39 arguments => [ 'hello', 'world' ],
40 environment => [
41 [
42 'GLOBUS_GRAM_JOB_CONTACT',
43 'https://globus.org:1234/2345/4332'
44 ]
45 ]
46 };
47
48 which corresponds to the rsl fragment
49
50 &(executable = /bin/echo)
51 (arguments = hello world)
52 (environment =
53 (GLOBUS_GRAM_JOB_CONTACT 'https://globus.org:1234/2345/4332')
54 )
55
56 When the library_path RSL attribute is specified, this object
57 modifies the environment RSL attribute value to append its value to
58 any system specific variables.
59
60 $description->add('name', $value);
61 Add a parameter to a job description. The parameter will be
62 normalized internally so that the access methods described below
63 will work with this new parameter. As an example,
64
65 $description->add('new_attribute', $new_value)
66
67 will create a new attribute in the JobDescription, which can be
68 accessed by calling the $description-new_attribute>() method.
69
70 $value $description->get('name');
71 Get a parameter from a job description. As an example,
72
73 $description->get('attribute')
74
75 will return the appropriate attribute in the JobDescription by
76 name.
77
78 $description->save([$filename])
79 Save the JobDescription, including any added parameters, to the
80 file named by $filename if present, or replacing the file used in
81 constructing the object.
82
83 $description->print_recursive($file_handle)
84 Write the value of the job description object to the file handle
85 specified in the argument list.
86
87 $description->parameter()
88 For any parameter defined in the JobDescription can be accessed by
89 calling the method named by the parameter. The method names are
90 automatically created when the JobDescription is created, and may
91 be invoked with arbitrary SillyCaps or underscores. That is, the
92 parameter gram_myjob may be accessed by the GramMyJob, grammyjob,
93 or gram_my_job method names (and others).
94
95 If the attributes does not in this object, then undef will be
96 returned.
97
98 In a list context, this returns the list of values associated with
99 an attribute.
100
101 In a scalar context, if the attribute's value consist of a single
102 literal, then that literal will be returned, otherwise undef will
103 be returned.
104
105 For example, from a JobDescription called $d constructed from a
106 description file containing
107
108 {
109 executable => [ '/bin/echo' ],
110 arguments => [ 'hello', 'world' ]
111 }
112
113 The following will hold:
114
115 $executable = $d->executable() # '/bin/echo'
116 $arguments = $d->arguments() # undef
117 @executable = $d->executable() # ('/bin/echo')
118 @arguments = $d->arguments() # ('hello', 'world')
119 $not_present = $d->not_present() # undef
120 @not_present = $d->not_present() # ()
121
122 To test for existence of a value:
123
124 @not_present = $d->not_present()
125 print "Not defined\n" if(!defined($not_present[0]));
126
127
128
129perl v5.16.3 2020-12-12 JobDescription(3pm)