コード例 #1
0
ファイル: ScriptInvoke.py プロジェクト: stuartw/WMCore
    def boot(self):
        """
        _boot_

        Import the Step Module & get the stepSpace object from it.
        Get an instance of the Script from the Script Factory

        """
        self.job = Bootstrap.loadJobDefinition()
        self.task = Bootstrap.loadTask(self.job)
        
        
        stepSpaceMod = __import__(self.stepModule,
                                  globals(), locals(), ['stepSpace'], -1)

        self.stepSpace = stepSpaceMod.stepSpace

        self.step = self.task.getStep(self.stepSpace.stepName)
        
        
        
        self.script = getScript(scriptModule)
        self.script.task = self.task
        self.script.step = self.step
        self.script.job = self.job
        self.script.stepSpace = self.stepSpace
コード例 #2
0
    def boot(self):
        """
        _boot_

        Import the Step Module & get the stepSpace object from it.
        Get an instance of the Script from the Script Factory

        """
        self.job = Bootstrap.loadJobDefinition()
        self.task = Bootstrap.loadTask(self.job)


        stepSpaceMod = __import__(self.stepModule,
                                  globals(), locals(), ['stepSpace'], -1)

        self.stepSpace = stepSpaceMod.stepSpace

        self.step = self.task.getStep(self.stepSpace.stepName)



        self.script = getScript(scriptModule)
        self.script.task = self.task
        self.script.step = self.step
        self.script.job = self.job
        self.script.stepSpace = self.stepSpace
コード例 #3
0
ファイル: ScriptInvoke.py プロジェクト: dmwm/WMCore
 def __init__(self, stepModule, scriptModule):
     self.stepModule = stepModule
     self.module = scriptModule
     self.exitCode = 0
     self.stepSpace = None
     self.script = None
     self.step = None
     self.task = None
     self.job = None
     currentDir = os.getcwd()
     Bootstrap.setupLogging(currentDir, useStdout=True)
     logging.info("Invoking scripts in current directory: %s", currentDir)
コード例 #4
0
 def __init__(self, stepModule, scriptModule):
     self.stepModule = stepModule
     self.module = scriptModule
     self.exitCode = 0
     self.stepSpace = None
     self.script = None
     self.step = None
     self.task = None
     self.job = None
     currentDir = os.getcwd()
     Bootstrap.setupLogging(currentDir, useStdout=True)
     logging.info("Invoking scripts in current directory: %s", currentDir)
コード例 #5
0
ファイル: Runtime_t.py プロジェクト: zhiwenuil/WMCore
def miniStartup(dir = os.getcwd()):
    """
    This is an imitation of the startup script
    I don't want to try sourcing the main() of the startup
    Or run this in subprocess

    """

    job = Bootstrap.loadJobDefinition()
    task = Bootstrap.loadTask(job)
    Bootstrap.createInitialReport(job = job,
                                  task = task,
                                  logLocation = "Report.0.pkl")
    monitor = Bootstrap.setupMonitoring(logPath = "Report.0.pkl")

    Bootstrap.setupLogging(dir)
    

    task.build(dir)
    task.execute(job)

    task.completeTask(jobLocation = os.path.join(dir, 'WMTaskSpace'),
                      logLocation = "Report.0.pkl")

    if monitor.isAlive():
        monitor.shutdown()


    return
コード例 #6
0
def miniStartup(dir = os.getcwd()):
    """
    This is an imitation of the startup script
    I don't want to try sourcing the main() of the startup
    Or run this in subprocess

    """

    job = Bootstrap.loadJobDefinition()
    task = Bootstrap.loadTask(job)
    Bootstrap.createInitialReport(job = job,
                                  task = task,
                                  logLocation = "Report.0.pkl")
    monitor = Bootstrap.setupMonitoring(logPath = "Report.0.pkl")

    Bootstrap.setupLogging(dir)


    task.build(dir)
    task.execute(job)

    task.completeTask(jobLocation = os.path.join(dir, 'WMTaskSpace'),
                      logLocation = "Report.0.pkl")

    if monitor.isAlive():
        monitor.shutdown()


    return
コード例 #7
0
ファイル: Startup.py プロジェクト: AndresTanasijczuk/WMCore
#!/usr/bin/env python
"""
_Startup_

Runtime environment startup script
"""
from __future__ import print_function

import os
import time
import WMCore.WMRuntime.Bootstrap as Bootstrap

if __name__ == '__main__':
    print("Startup.py : %s : loading job definition" % time.strftime("%Y-%m-%dT%H:%M:%S"))
    job = Bootstrap.loadJobDefinition()
    print("Startup.py : %s : loading task" % time.strftime("%Y-%m-%dT%H:%M:%S"))
    task = Bootstrap.loadTask(job)
    print("Startup.py : %s : setting up monitoring" % time.strftime("%Y-%m-%dT%H:%M:%S"))
    logLocation = "Report.%i.pkl" % job['retry_count']
    Bootstrap.createInitialReport(job = job,
                                  task = task,
                                  logLocation = logLocation)
    monitor = Bootstrap.setupMonitoring(logPath = logLocation)

    print("Startup.py : %s : setting up logging" % time.strftime("%Y-%m-%dT%H:%M:%S"))
    Bootstrap.setupLogging(os.getcwd())

    print("Startup.py : %s : building task" % time.strftime("%Y-%m-%dT%H:%M:%S"))
    task.build(os.getcwd())
    print("Startup.py : %s : executing task" % time.strftime("%Y-%m-%dT%H:%M:%S"))
    task.execute(job)
コード例 #8
0
 3. the task space area, where the steps and cmsRun logs are
"""
from __future__ import print_function

import logging
import os
import sys

import WMCore.WMRuntime.Bootstrap as Bootstrap

if __name__ == '__main__':
    logging.info(
        "This log line goes to a parallel universe, but ... setting up logging"
    )
    # WMAgent log has to be written to the pilot area in order to be transferred back
    Bootstrap.setupLogging(os.path.join(os.getcwd(), '../'))
    logging.info("Process id: %s\tCurrent working directory: %s", os.getpid(),
                 os.getcwd())
    logging.info("Python version: %s", sys.version)
    logging.info("Python path: %s", sys.path)

    logging.info("Loading job definition")
    job = Bootstrap.loadJobDefinition()

    logging.info("Loading task")
    task = Bootstrap.loadTask(job)

    logging.info("Setting up monitoring")
    reportName = "Report.%i.pkl" % job['retry_count']

    Bootstrap.createInitialReport(job=job, reportName=reportName)
コード例 #9
0
ファイル: Startup.py プロジェクト: menglu21/WMCore
#!/usr/bin/env python
"""
_Startup_

Runtime environment startup script
"""
from __future__ import print_function

import os
import time
import WMCore.WMRuntime.Bootstrap as Bootstrap

if __name__ == '__main__':
    print("Startup.py : %s : loading job definition" %
          time.strftime("%Y-%m-%dT%H:%M:%S"))
    job = Bootstrap.loadJobDefinition()
    print("Startup.py : %s : loading task" %
          time.strftime("%Y-%m-%dT%H:%M:%S"))
    task = Bootstrap.loadTask(job)
    print("Startup.py : %s : setting up monitoring" %
          time.strftime("%Y-%m-%dT%H:%M:%S"))
    logLocation = "Report.%i.pkl" % job['retry_count']
    Bootstrap.createInitialReport(job=job, task=task, logLocation=logLocation)
    monitor = Bootstrap.setupMonitoring(logPath=logLocation)

    print("Startup.py : %s : setting up logging" %
          time.strftime("%Y-%m-%dT%H:%M:%S"))
    Bootstrap.setupLogging(os.getcwd())

    print("Startup.py : %s : building task" %
          time.strftime("%Y-%m-%dT%H:%M:%S"))
コード例 #10
0
Just a FYI, there are basically 3 important directories:
 1. the pilot home area, where the condor wrapper logs are
 2. the job space area, where the sandbox and the runtime log is created
 3. the task space area, where the steps and cmsRun logs are
"""
from __future__ import print_function

import logging
import os

import WMCore.WMRuntime.Bootstrap as Bootstrap

if __name__ == '__main__':
    logging.info("This log line goes to a parallel universe, but ... setting up logging")
    # WMAgent log has to be written to the pilot area in order to be transferred back
    Bootstrap.setupLogging(os.path.join(os.getcwd(), '../'))
    logging.info("Process id: %s\tCurrent working directory: %s", os.getpid(), os.getcwd())

    logging.info("Loading job definition")
    job = Bootstrap.loadJobDefinition()

    logging.info("Loading task")
    task = Bootstrap.loadTask(job)

    logging.info("Setting up monitoring")
    reportName = "Report.%i.pkl" % job['retry_count']

    Bootstrap.createInitialReport(job=job, reportName=reportName)
    monitor = Bootstrap.setupMonitoring(logName=reportName)

    logging.info("Building task at directory: %s", os.getcwd())