[torquedev] new node attribute: "note"
Garrick Staples
garrick at usc.edu
Tue Jan 30 22:36:59 MST 2007
On Tue, Jan 30, 2007 at 10:12:18PM -0700, Marcus R. Epperson alleged:
> Garrick Staples wrote:
> >On Wed, Jan 24, 2007 at 10:15:06AM -0700, Marcus R. Epperson alleged:
> >>On 01/24/2007 12:17 AM, Garrick Staples wrote:
> >>>One question, where are the notes stored on disk? I only flipped the
> >>>patch real quick, but didn't see it.
> >>Hmm, good point. This attribute probably should survive a server
> >>restart. :) I'll look into that.
> >>
> >>How does /var/spool/torque/server_priv/note_attr sound?
> >
> >Should probably have "node" in the name. node_note?
>
> Sounds good. How does this look? (attached)
That's looking pretty good! I can't wait to merge this.
Do we need to worry about ugly characters in the node_note file? Like
newlines? I think that will break things.
> diff -Naurp --exclude torque.spec --exclude cscope.out --exclude '*.swp' torque-2.2.0-snap.200701181022.orig/src/include/pbs_ifl.h torque-2.2.0-snap.200701181022/src/include/pbs_ifl.h
> --- torque-2.2.0-snap.200701181022.orig/src/include/pbs_ifl.h 2007-01-09 19:49:00.000000000 -0700
> +++ torque-2.2.0-snap.200701181022/src/include/pbs_ifl.h 2007-01-28 23:02:12.000000000 -0700
> @@ -105,6 +105,10 @@
>
> #endif /* __STDC__ */
>
> +/* Macros used to convert a #define'd value to a string literal */
> +#define STR(x) #x
> +#define TEXT(x) "" STR(x) ""
> +
Will that be portable? TORQUE is built on a very wide variety of OSes
and compilers, we have to keep things pretty simple.
This might be perfectly safe, but I'm not good enough of a programmer to
know :)
> + sprintf(log_buffer,"Warning: Client attempted to set note with len (%d) > MAX_NOTE (%d)",
> + nsize,
> + MAX_NOTE);
Can we return this to pbsnodes? I don't know off the top of my head if
we can.
> + /* initialize note attributes */
> + nin = fopen(path_nodenote,"r");
> +
> + if (nin != NULL)
> + {
> +
> + while (fscanf(nin,"%s %" TEXT(MAX_NOTE) "[^\n]",
> + line,
> + note) == 2)
> + {
> + for (i = 0;i < svr_totnodes;i++)
> + {
> + np = pbsndmast[i];
> +
> + if (strcmp(np->nd_name,line) == 0)
Do we need to skip deleted nodes here? I think nd_name could be null.
> +void write_node_note()
> +
> + {
> + struct pbsnode *np;
> + static char *fmt = "%s %s\n";
> + int i;
> +
> + if (LOGLEVEL >= 5)
> + DBPRT(("write_node_note: entered\n"))
> +
> + if (nnotef != NULL)
> + {
> + fseek(nnotef,0L,SEEK_SET); /* rewind and clear */
> +
> + if (ftruncate(fileno(nnotef),(off_t)0) != 0)
> + {
> + log_err(errno,"write_node_note","could not truncate file");
> +
> + return;
> + }
I know that node_status follows this same behaviour, but can it write to
a tmp file and then atomically link it to node_note? This will help
save us from bad things like full disks.
--
Garrick Staples, Linux/HPCC Administrator
University of Southern California
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.supercluster.org/pipermail/torquedev/attachments/20070130/24373d41/attachment-0001.bin
More information about the torquedev
mailing list