Skip to main content

INDEPENDENT

attribute := expression : INDEPENDENT [(cluster)] ;

attributeThe name of the Attribute.
expressionThe definition of the attribute.
clusterOptional. A string constant specifying the name of the Thor cluster on which execute. If omitted, the attribute is run on the currently executing cluster.

The INDEPENDENT service causes the attribute to be evaluated at a global scope and forces the attribute evaluation into a separate workflow item. The new workflow item is evaluated before the first workflow item that uses that attribute. It executes independently from other workflow items, and is only executed once (including inside SEQUENTIAL where it should be executed the first time it is used). It will not share any code with any other workflow items.

One use would be to provide a mechanism for commoning up code that is shared between different arguments to a SEQUENTIAL action--normally they are evaluated completely independently.

Example:

  IMPORT STD;
  File1 := 'names1.txt';
  File2 := 'names2.txt';
  
  SrcIP := '10.239.219.2';
  SrcPath := '/var/lib/HPCCSystems/mydropzone/';
  DestPath := '~THOR::IN::';
  ESPportIP := 'http://192.168.56.120:8010/FileSpray';
  
  DeleteOldFiles :=
     PARALLEL(STD.File.DeleteLogicalFile(DestPath+File1),
              STD.File.DeleteLogicalFile(DestPath+File2))
                           : INDEPENDENT;
  SprayNewFiles :=
     PARALLEL(STD.File.SprayFixed(SrcIP,SrcPath+File1,11,
                                      'mythor',DestPath+File1,
                                      -1,ESPportIP),
              STD.File.SprayFixed(SrcIP,SrcPath+File2,11,
                                     'mythor',DestPath+File2,
                                     -1,ESPportIP))
                           : INDEPENDENT;
    SEQUENTIAL(DeleteOldFiles,SprayNewFiles);

See Also: GLOBAL