Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1700915

Summary: inconsistent MAXTIME vs MAX_TIME
Product: [Retired] Restraint Reporter: Jeff Bastian <jbastian>
Component: generalAssignee: Tomas Klohna 🔧 <tklohna>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 0.1.39CC: asavkov, bpeck, breilly, cbeer, mastyk, tklohna
Target Milestone: 0.1.40Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-20 11:47:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeff Bastian 2019-04-17 16:04:28 UTC
Description of problem:
restraint can take a task parameter RSTRNT_MAX_TIME to override the default task's max_time (or TestTime) value:
https://restraint.readthedocs.io/en/latest/jobs.html#parameters


But it sets an environment variable RSTRNT_MAXTIME -- without the underscore -- for the task while running:
https://restraint.readthedocs.io/en/latest/variables.html#variables
https://git.beaker-project.org/cgit/restraint/tree/src/env.c#n137

Please make the names consistent, or better yet, accept both RSTRNT_MAXTIME and RSTRNT_MAX_TIME params for compatibility, and maybe export both as environment variables.

Version-Release number of selected component (if applicable):
restraint-0.1.39

Comment 1 Jeff Bastian 2019-04-17 16:05:25 UTC
Oops, I forgot the link to the source code for the parameter:
https://git.beaker-project.org/cgit/restraint/tree/src/task.c#n328

Comment 2 Tomas Klohna 🔧 2019-05-13 15:02:07 UTC
Looking at the flow, it makes sense to me though.
1. You define the max time in the task metadata
2. In case you have RSTRNT_MAX_TIME defined you overwrite that value
3. Value of max time is extracted to RSTRNT_MAXTIME

I'm not sure if we are making any changes to max time between the steps 2 and 3 but in case we need to that in the future, we won't cause any breaking. But I understand the point and I would actually be for deprecating RSTRNT_MAX_TIME in favor for KILLTIMEOVERRIDE so there's no confusion.

Comment 3 Bill Peck 2019-05-13 15:11:32 UTC
Just to let you know, the RSTRNT_ prefix was used to keep from possibly contaminating the environment variables..

Comment 4 Jeff Bastian 2019-05-13 18:51:49 UTC
The inconsistency is confusing, though, for writing a task vs running it.

When writing a task, you might check it like so:

  if [ $RSTRNT_MAXTIME -lt $THRESHOLD ]; then
    ...
  fi

And then you schedule a Beaker job to run your task and have to set a different name:

  <params>
    <param name="RSTRNT_MAX_TIME" value="100"/>
  </params>

Trying to remember which one takes the underscore and which one does not is a recipe for a headache.

Comment 5 Bill Peck 2019-05-13 19:38:01 UTC
(In reply to Jeff Bastian from comment #4)
> The inconsistency is confusing, though, for writing a task vs running it.
> 
> When writing a task, you might check it like so:
> 
>   if [ $RSTRNT_MAXTIME -lt $THRESHOLD ]; then
>     ...
>   fi
> 
> And then you schedule a Beaker job to run your task and have to set a
> different name:
> 
>   <params>
>     <param name="RSTRNT_MAX_TIME" value="100"/>
>   </params>
> 
> Trying to remember which one takes the underscore and which one does not is
> a recipe for a headache.

I get that Jeff,  I was suggesting we support both and only document one.  I believe Tomas suggestions was to document the non name-spaced KILLTIMEOVERRIDE.

Comment 6 Martin Styk 2019-09-10 05:57:54 UTC
Restraint 0.1.40 has been released.