LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Special Parameters - Help on a Log Issue

    Employee
    Posted 11-01-2012 13:09

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Hi,

    We have a piece of code that runs on every graph we have. Its an audit log record loaded into our DB. Within the code, there is a node that renames a temporary BRD created by using the following parameters.

    BRD Filename: {{^LogDirectory^}}/audit_log_{{^BRDHandle^}}
    Log File = {{*LogDirectory*}}
    BRDHandle = {{^Handle^}}.brd

    After the temp file is written, a move node runs and does the following piece of code:

    if
    firstExec
    then
    "data".consume(true)

    graphName = 'Graph Name'
    oldFileName =
    strcat(
    "{{^BaseFileName^}}",
    "_",
    "{{^BRDHandle^}}"
    )
    newFileName =
    strcat(
    "{{^BaseFileName^}}",
    "_",
    graphName,
    ".brd"
    )
    oldFileName.appendBrd(newFileName)
    oldFileName.deleteFile()

    emit *


    This issue is, lets say we have 5 graphs and they all run at the same time, and since they share this code, we get collisions whereby one graph is removing the file, shared by another until the rename. This causes a graph or graphs to fail.

    How would one recommend we change the code to say in the Common Code that the temporary code is unique enough to prevent this from happening?

    Regards
    Wayne


  • 2.  RE: Special Parameters - Help on a Log Issue

    Employee
    Posted 11-01-2012 13:21

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    Is there something makes the five graph runs unique? Do all 5 graphs get started at EXACTLY the same time?
    You could set set a unix variable p_context_stamp=`date +%Y%m%d%H%M%S` and then refer to that parameter inside the graph to make the temp file unique to each run.


  • 3.  RE: Special Parameters - Help on a Log Issue

    Employee
    Posted 11-02-2012 06:32

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Hi,

    Thankyou for your reply. the majority of the graphs don't start at the same time, but it doesn't mean we want to do that.

    So, just to clarify in your solution I would do the following:

    Update the Properties File and add in a new variable in the graph called context_stamp and amend the temp BRD file to BRD Filename: {{^LogDirectory^}}/audit_log_{{^context_stamp^}}_{{^BRDHandle^}}
    On the BRS I would add a new value called p_context_stamp and pass that run from my controlling scripts?

    Regards
    Wayne


  • 4.  RE: Special Parameters - Help on a Log Issue

    Employee
    Posted 11-02-2012 07:32

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    That's what I've done in several cases, yes. p_context_stamp can be anything that makes the individual run unique. In some cases we use a counter, in other cases the date/time, and in other cases we use the CORP value - a unique company number, or even in some cases we use the name of the City that the graph is executing for.


  • 5.  RE: Special Parameters - Help on a Log Issue

    Employee
    Posted 11-02-2012 08:38

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Ok, thanks. Makes sense. I'll get working on making the change and testing it out.