HP3000-L Archives

May 2019, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Roy Brown <[log in to unmask]>
Reply To:
Roy Brown <[log in to unmask]>
Date:
Sun, 26 May 2019 07:51:36 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (73 lines)
For me, Olav gets the big door prize for brevity, speed of execution, maintainability, and just sheer elegance. 

(The only possibly unique but inelegant solution to anything that I can ever recall is the Gosper Gun, which troubles me philosophically. There ought to be an elegant solution, dammit).

Riffing on Stan’s ‘sneaky approach’, my general stance is that if I want to do something in a jobstream, then why wouldn’t I do it in that jobstream? To which the answer is the same in CI programming as in any other programming language; I want to extract a block of common, possibly complex, code into a single subroutine I can call from many different places, know it is the same each time, and can maintain it in just one place.

Presumably, this is what Reggie has done*; his code is in a command file, all his jobstreams execute this command file, and the too-large IF construct is intended to filter these for some payload applicable only to certain jobstreams.

So amending Stan’s idea slightly, if you know there are a bunch of things your jobstream is and isn’t going to want to do in that command file, you set a little block of global vars at the start of the jobstream (glob_rerun, yes; glob_abort_proc, no; glob_log, yes; - that sort of thing) and then the command file can test for these variables instead of a whole list of jobnames, and cover all sorts of common jobstream tasks, each for only the applicable jobstreams.

A little more maintainable and scalable, perhaps, with vars instead of companion confíg files.

This does still require upfront planning though; and when you think of a new common task, it is much easier to put it in the command file with an Olav-style IF POS than to extend possibly tens of existing jobstreams with a new glob_var :-)

*Reggie, I am aware we have concentrated on solving your problem rather than asking why you have it in the first place; would you care to enlighten us on the circumstances in which it comes about, which might not be the same as what I have conjectured above?



Sent from my iPad

> On 26 May 2019, at 02:47, Stan Sieler <[log in to unmask]> wrote:
> 
> Roy and Olav had some clever solutions.
> 
> Another possibility is:
> 
> setvar match false
> 
> IF HPJOBNAME="M06266" OR HPJOBNAME="M03024" OR HPJOBNAME="M10620" then
>  setvar match true
> 
> elseif HPJOBNAME="T94211" OR HPJOBNAME="M12813" OR HPJOBNAME="M11359" then
>  setvar match true
> 
> elseif HPJOBNAME="M17057" OR HPJOBNAME="M14878" OR HPJOBNAME="M51207" then
>  setvar match true
> 
> ...
> endif
> 
> if match then
>  ...
> 
> A sneaky approach is:
> 
>  setvar match false
>  if finfo (hpjobname, "exists") then
>     xeq !hpjobname
>       # some files, like M17057, exist that have one line:   setvar match
> true
>       # thus, we rely on that *external* file to tell us if we want to do
> whatever it is.
>  endif
> 
> With that kind of approach, you can setup a jobname related file to
> configure various things,
> and at the start of your jobs:
> 
>    if finfo ("!hpjobname.config", "exists") then
>       xeq !["!hpjobname.config"]
>  endif
> (You might have to experiment with the syntax of the expression after
> 'xeq', I'm not
> a CI programming expert, and I didn't test it, either.)
> 
> Stan
> 
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2