我需要通过 Perl API 向 SLURM 提交作业的这种“job_desc_msg_t”格式是什么?
What is this `job_desc_msg_t` format that I need to submit jobs to SLURM via the Perl API?
Perl API for SLURM表示提交带有API的作业需要我们给它一个"job description"($job_desc
或$job_desc_msg
),这具有结构 job_desc_msg_t
但它没有说明 job_desc_msg_t
是什么。
更新:我在 slurm.h starting at line 1162 中找到了它,所以我猜我需要传入一个具有类似结构的散列。
根据手册页,这正是您必须执行的操作。
Typicaly, C structures are converted to (maybe blessed) Perl hash
references, with field names as hash keys. Arrays in C are converted to
arrays in Perl. For example, there is a structure "job_info_msg_t":
typedef struct job_info_msg {
time_t last_update; /* time of latest info */
uint32_t record_count; /* number of records */
job_info_t *job_array; /* the job records */
} job_info_msg_t;
This will be converted to a hash reference with the following
structure:
{
last_update => 1285847672,
job_array => [ {account => 'test', alloc_node => 'ln0', alloc_sid => 1234, ...},
{account => 'debug', alloc_node => 'ln2', alloc_sid => 5678, ...},
...
]
}
Note the missing of the "record_count" field in the hash. It can be
derived from the number of elements in array "job_array".
To pass parameters to the API functions, use the corresponding hash
references, for example:
$rc = $slurm->update_node({node_names => 'node[0-7]', node_state => NODE_STATE_DRAIN});
Please see "<slurm/slurm.h>" for the definition of the structures.
Perl API for SLURM表示提交带有API的作业需要我们给它一个"job description"($job_desc
或$job_desc_msg
),这具有结构 job_desc_msg_t
但它没有说明 job_desc_msg_t
是什么。
更新:我在 slurm.h starting at line 1162 中找到了它,所以我猜我需要传入一个具有类似结构的散列。
根据手册页,这正是您必须执行的操作。
Typicaly, C structures are converted to (maybe blessed) Perl hash references, with field names as hash keys. Arrays in C are converted to arrays in Perl. For example, there is a structure "job_info_msg_t":
typedef struct job_info_msg { time_t last_update; /* time of latest info */ uint32_t record_count; /* number of records */ job_info_t *job_array; /* the job records */ } job_info_msg_t;
This will be converted to a hash reference with the following structure:
{ last_update => 1285847672, job_array => [ {account => 'test', alloc_node => 'ln0', alloc_sid => 1234, ...}, {account => 'debug', alloc_node => 'ln2', alloc_sid => 5678, ...}, ... ] }
Note the missing of the "record_count" field in the hash. It can be derived from the number of elements in array "job_array".
To pass parameters to the API functions, use the corresponding hash references, for example:
$rc = $slurm->update_node({node_names => 'node[0-7]', node_state => NODE_STATE_DRAIN});
Please see "<slurm/slurm.h>" for the definition of the structures.