-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Torque module doesn't support job arrays #64
Comments
Original comment by
|
Hi, I would be interested in this as well. I found the torque source code here: Usually jobids are in the for of 12345 but in arrays an index is added, so it looks like 12345[1], 12345[2], ... Obviously the code exits when it tries to convert the string "jobid" to long int "jid" with "strtoul". So preserving the array index or use char instead of int and just regex for [0-9[]] should work, the rest is actually the same. Best, |
What if you just take out the code that verifies the jobid, and let Torque do the verification? As I said, I don't personally have access to a Torque/PBS system on which to test, and I'm not even the author of the original code, but perhaps you could test something like this? Feel free to open a PR if you find something that works, or have other fixes. Thanks! diff --git a/src/modules/torque.c b/src/modules/torque.c
index 4d7f6e3..2ceacd1 100644
--- a/src/modules/torque.c
+++ b/src/modules/torque.c
@@ -124,23 +124,6 @@ static int mod_torque_init (void)
}
-static int32_t str2jobid (const char *str)
-{
- char *p = NULL;
- long int jid;
-
- if (str == NULL)
- return (-1);
-
- jid = strtoul (str, &p, 10);
-
- if( *p != '\0' )
- errx ("%p: invalid jobid format \"%s\" for -j\n", str);
-
- return ((int32_t) jid);
-}
-
-
static int
torque_process_opt(opt_t *pdsh_opts, int opt, char *arg)
{
@@ -180,14 +163,8 @@ static int mod_torque_wcoll(opt_t *opt)
return 0;
}
-static void _create_fq_jobid(char *dst, const char *jobid, const char *serverna
- /*
- * Create fully qualified jobid, "<integer>.<servername>"
- */
- if ( str2jobid(jobid) < 0 ){
- *dst = '\0';
- return;
- }
+static void _create_fq_jobid(char *dst, const char *jobid, const char *serverna
+{
strncpy(dst, jobid, PBS_MAXSEQNUM);
strncat(dst, ".", 1);
strncat(dst, servername, PBS_MAXSERVERNAME);
|
Obviously the easiest way :)
Thanks a lot! Complete diff (not truncated):
|
For completion here errors for malformed IDs:
Corresponding Torque jobs stats:
This seems OK. Works with Moab numeric IDs and Moab job arrays as well. |
Great, thanks for testing. Just to verify, should I throw this commit into master? |
I would say yes. It's less broken than before AFAICT. And if the module gets a wrong ID Torque just complains. If it is OK it gets the Job stats correctly. I think there's no need to check if the ID is formatted correctly. Thanks a lot again. |
Thank you for testing! On Wed, Aug 17, 2016 at 2:44 PM, Michael [email protected] wrote:
|
Torque/PBS jobids are not necessarily strict integers, for example array jobs have the array index in brackets following the jobid. Since jobids are passed to Torque API as strings, just skip the attempt to convert to integer (and corresponding error for array jobs), and let the Torque API report any jobid error back to user. Fixes #64
Original issue reported on code.google.com by
[email protected]
on 21 May 2014 at 3:16The text was updated successfully, but these errors were encountered: