我需要通过Perl API将作业提交到SLURM的"job_desc_msg_t"格式是什么?



用于SLURM的Perl API表明,要使用API提交作业需要我们给它一个"作业描述"($job_desc$job_desc_msg),它具有结构job_desc_msg_t,但它没有告诉job_desc_msg_t是什么。

更新:我从第 1162 行开始在 slurm.h 中找到了它,所以我猜我需要传入具有类似结构的哈希。

这正是根据手册页必须执行的操作。

通常,C 结构被转换为(也许是祝福的)Perl 哈希 引用,字段名称作为哈希键。C 中的数组转换为 Perl 中的数组。例如,有一个结构"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;

这将转换为哈希引用,如下所示 结构:

{
last_update => 1285847672,
job_array => [ {account => 'test', alloc_node => 'ln0', alloc_sid => 1234, ...},
{account => 'debug', alloc_node => 'ln2', alloc_sid => 5678, ...},
...
]
}

请注意哈希中缺少"record_count"字段。它可以是 派生自数组"job_array"中的元素数。

要将参数传递给 API 函数,请使用相应的哈希 参考文献,例如:

$rc = $slurm->update_node({node_names => 'node[0-7]', node_state => NODE_STATE_DRAIN});

请参阅"了解结构的定义。

最新更新