在WLST(weblogic脚本工具)中导入python模块

2024-10-02 04:32:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要在WLST中导入python模块。例如,我需要WLST中的“信号”模块来编写超时函数。所以我问你怎么做

环境: Oracle Linux 6, Oracle Weblogic 11

此外,我让您看到WLST中的一段代码,其中我需要一个超时函数,以及它引发异常的原因:

import sys
import os
from java.lang import System
import getopt
import time as systime

[...]

def _startServer(ServerName):
    while(true)
        try:
            cd('domainRuntime:/ServerLifeCycleRuntimes/'+ServerName);

            cmo.start();
            state=_serverstatus(ServerName);
            while (state!='RUNNING'):
                state=_serverstatus(ServerName);
                java.lang.Thread.sleep(5000);

            #=================
            # timeout function
            #=================

        except:
            print 'Error in getting current status of ' +ServerName+ '\n';
            print 'Please check logged in user has full access to complete the start operation on ' +ServerName+ '\n';

            os.popen('sh /home/oracle/scripts/logAnalytics.sh')
            systime.sleep(60)

            exit()
        break

[...]

Tags: 模块函数importlangossleepjavastart

热门问题