示例#1
0
 def processEachArg(argStr):
     varNameValue = argStr.split('=')
     icm.FILE_ParamWriteToPath(
         parNameFullPath=os.path.join(
             configPkgInfoFpBaseDir_obtain(configBaseDir=configBaseDir),
             varNameValue[0],
         ),
         parValue=varNameValue[1],
     )
def commonParamsDefaultsSet(interactive=icm.Interactivity.Both, ):
    """ Set Monitor FILE_Params to their defaults."""
    ####+BEGIN: bx:dblock:global:file-insert :file "/libre/ByStar/InitialTemplates/software/plusOrg/dblock/inserts/icmFuncHead.py"

    ####+END:

    if icm.Interactivity().interactiveInvokation(interactive):
        icmRunArgs = G.icmRunArgsGet()
        if icm.cmndArgsLengthValidate(cmndArgs=icmRunArgs.cmndArgs,
                                      expected=0,
                                      comparison=icm.int__gt):
            return (icm.ReturnCode.UsageError)

    icm.FILE_ParamWriteToPath(
        parNameFullPath="./icmsIn/control/targetsChunkSize", parValue=200)
    icm.FILE_ParamWriteToPath(
        parNameFullPath="./icmsIn/control/paramWriterBufferSize", parValue=500)
    icm.FILE_ParamWriteToPath(
        parNameFullPath="./icmsIn/control/paramReaderBufferSize", parValue=100)
    icm.FILE_ParamWriteToPath(
        parNameFullPath="./icmsIn/control/exclusionListsControl",
        parValue="fullyIgnore")
    icm.FILE_ParamWriteToPath(
        parNameFullPath="./icmsIn/control/execResultsControl",
        parValue="complete")
    icm.FILE_ParamWriteToPath(
        parNameFullPath="./icmsIn/control/cmParamsVerificationControl",
        parValue="none")

    return
示例#3
0
        def createPathAndFpWrite(
            fpPath,
            valuePath,
        ):
            valuePath = os.path.abspath(valuePath)
            try:
                os.makedirs(valuePath)
            except OSError:
                if not os.path.isdir(valuePath):
                    raise

            icm.FILE_ParamWriteToPath(
                parNameFullPath=fpPath,
                parValue=valuePath,
            )
示例#4
0
    def cmnd(
            self,
            interactive=False,  # Can also be called non-interactively
            configBaseDir=None,  # or Cmnd-Input
            bxoId=None,  # or Cmnd-Input
            sr=None,  # or Cmnd-Input
            argsList=[],  # or Args-Input
    ):
        cmndOutcome = self.getOpOutcome()
        if interactive:
            if not self.cmndLineValidate(outcome=cmndOutcome):
                return cmndOutcome
            effectiveArgsList = G.icmRunArgsGet().cmndArgs
        else:
            effectiveArgsList = argsList

        callParamsDict = {
            'configBaseDir': configBaseDir,
            'bxoId': bxoId,
            'sr': sr,
        }
        if not icm.cmndCallParamsValidate(
                callParamsDict, interactive, outcome=cmndOutcome):
            return cmndOutcome
        configBaseDir = callParamsDict['configBaseDir']
        bxoId = callParamsDict['bxoId']
        sr = callParamsDict['sr']

        cmndArgsSpecDict = self.cmndArgsSpec()
        if not self.cmndArgsValidate(
                effectiveArgsList, cmndArgsSpecDict, outcome=cmndOutcome):
            return cmndOutcome
####+END:
        if not configBaseDir:
            configBaseDir = configBaseDir_obtain()

        cmndArgs = self.cmndArgsGet("0&-1", cmndArgsSpecDict,
                                    effectiveArgsList)

        def createPathAndFpWrite(
            fpPath,
            valuePath,
        ):
            valuePath = os.path.abspath(valuePath)
            try:
                os.makedirs(valuePath)
            except OSError:
                if not os.path.isdir(valuePath):
                    raise

            icm.FILE_ParamWriteToPath(
                parNameFullPath=fpPath,
                parValue=valuePath,
            )

        def processEachArg(argStr):
            varNameValue = argStr.split('=')
            icm.FILE_ParamWriteToPath(
                parNameFullPath=os.path.join(
                    configPkgInfoFpBaseDir_obtain(configBaseDir=configBaseDir),
                    varNameValue[0],
                ),
                parValue=varNameValue[1],
            )

        # Any number of Name=Value can be passed as args
        for each in cmndArgs:
            processEachArg(each)

        if bxoId:
            parNameFullPath = icm.FILE_ParamWriteToPath(
                parNameFullPath=os.path.join(
                    configPkgInfoFpBaseDir_obtain(configBaseDir=configBaseDir),
                    "bxoId",
                ),
                parValue=bxoId,
            )

        if sr:
            parNameFullPath = icm.FILE_ParamWriteToPath(
                parNameFullPath=os.path.join(
                    configPkgInfoFpBaseDir_obtain(configBaseDir=configBaseDir),
                    "sr",
                ),
                parValue=sr,
            )

        if interactive:
            parValue = icm.FILE_ParamValueReadFromPath(parNameFullPath)
            icm.ANN_here(
                "pkgInfoParsSet: {parValue} at {parNameFullPath}".format(
                    parValue=parValue, parNameFullPath=parNameFullPath))

        return cmndOutcome.set(
            opError=icm.OpError.Success,
            opResults=None,
        )
示例#5
0
    def cmnd(self,
        interactive=False,        # Can also be called non-interactively
        icmsPkgInfoBaseDir=None,         # or Cmnd-Input
        icmsPkgName=None,         # or Cmnd-Input
        icmsPkgControlBaseDir=None,         # or Cmnd-Input
        icmsPkgVarBaseDir=None,         # or Cmnd-Input
        icmsPkgTmpBaseDir=None,         # or Cmnd-Input
        icmsPkgBasesPolicy=None,         # or Cmnd-Input
        icmsPkgLogBaseDir=None,         # or Cmnd-Input
    ):
        cmndOutcome = self.getOpOutcome()
        if interactive:
            if not self.cmndLineValidate(outcome=cmndOutcome):
                return cmndOutcome

        callParamsDict = {'icmsPkgInfoBaseDir': icmsPkgInfoBaseDir, 'icmsPkgName': icmsPkgName, 'icmsPkgControlBaseDir': icmsPkgControlBaseDir, 'icmsPkgVarBaseDir': icmsPkgVarBaseDir, 'icmsPkgTmpBaseDir': icmsPkgTmpBaseDir, 'icmsPkgBasesPolicy': icmsPkgBasesPolicy, 'icmsPkgLogBaseDir': icmsPkgLogBaseDir, }
        if not icm.cmndCallParamsValidate(callParamsDict, interactive, outcome=cmndOutcome):
            return cmndOutcome
        icmsPkgInfoBaseDir = callParamsDict['icmsPkgInfoBaseDir']
        icmsPkgName = callParamsDict['icmsPkgName']
        icmsPkgControlBaseDir = callParamsDict['icmsPkgControlBaseDir']
        icmsPkgVarBaseDir = callParamsDict['icmsPkgVarBaseDir']
        icmsPkgTmpBaseDir = callParamsDict['icmsPkgTmpBaseDir']
        icmsPkgBasesPolicy = callParamsDict['icmsPkgBasesPolicy']
        icmsPkgLogBaseDir = callParamsDict['icmsPkgLogBaseDir']

####+END:

        #G = icm.IcmGlobalContext()        

        def createPathAndFpWrite(
                fpPath,
                valuePath,
        ):
            valuePath = os.path.abspath(valuePath)
            try:
                os.makedirs(valuePath)
            except OSError:
                if not os.path.isdir(valuePath):
                    raise
            
            icm.FILE_ParamWriteToPath(
                parNameFullPath=fpPath,
                parValue=valuePath,
            )

            
        if icmsPkgName:
            icm.FILE_ParamWriteToPath(
                parNameFullPath=os.path.join(pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), "icmsPkgName"),
                parValue=icmsPkgName,
            )

        if icmsPkgBasesPolicy:
            icm.FILE_ParamWriteToPath(
                parNameFullPath=os.path.join(pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), "icmsPkgBasesPolicy"),
                parValue=icmsPkgBasesPolicy,
            )

        if icmsPkgControlBaseDir:
            createPathAndFpWrite(
                os.path.join(pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), "icmsPkgControlBaseDir"),
                icmsPkgControlBaseDir,
            )

        if icmsPkgVarBaseDir:
            createPathAndFpWrite(
                os.path.join(pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), "icmsPkgVarBaseDir"),
                icmsPkgVarBaseDir,
            )

        if icmsPkgLogBaseDir:
            createPathAndFpWrite(
                os.path.join(pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), "icmsPkgLogBaseDir"),
                icmsPkgLogBaseDir,
            )
            
        if icmsPkgTmpBaseDir:
            createPathAndFpWrite(
                os.path.join(pkgInfoFpBaseDir_obtain(icmsPkgInfoBaseDir=icmsPkgInfoBaseDir), "icmsPkgTmpBaseDir"),
                icmsPkgTmpBaseDir,
            )
            
        if interactive:
            icm.ANN_here("pkgInfoParsSet")

        return cmndOutcome.set(
            opError=icm.OpError.Success,
            opResults=None,
        )