1

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

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

4

1 回答 1

4

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

通常,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});

有关结构的定义,请参阅“<slurm/slurm.h>”。

于 2015-05-06T17:30:39.607 回答