Skip to content

Commit

Permalink
update some object name
Browse files Browse the repository at this point in the history
  • Loading branch information
yodeng committed Apr 28, 2023
1 parent b49719c commit 5c7b9c0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions runjob/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .utils import Mylog as log
from .utils import getlog as log
from .utils import JobQueue, QsubError, JobFailedError
from .loger import Formatter
from ._version import __version__
from .qsub import qsub as runjob
from .sge_run import RunSge as runsge
from .run import RunJob as runsge
from .config import load_config as Config
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def _entrys(self):
'%s = %s.qsub:main' % (self.name, self.name),
'%s = %s.jobstat:main' % ("qs", self.name),
'%s = %s.jobstat:batchStat' % ("qcs", self.name),
'%s = %s.sge_run:main' % ("runsge", self.name),
'%s = %s.sge_run:main' % ("runshell", self.name),
'%s = %s.sge_run:main' % ("runbatch", self.name),
'%s = %s.run:main' % ("runsge", self.name),
'%s = %s.run:main' % ("runshell", self.name),
'%s = %s.run:main' % ("runbatch", self.name),
]
return eps

Expand Down
4 changes: 2 additions & 2 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .utils import Mylog as log
from .utils import getlog as log
from .utils import JobQueue, QsubError, JobFailedError
from .loger import Formatter
from ._version import __version__
from .qsub import qsub as runjob
from .sge_run import RunSge as runsge
from .run import RunJob as runsge
from .config import load_config as Config
5 changes: 2 additions & 3 deletions src/jobstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
qcs --help
'''

from __future__ import print_function
import os
import re
import sys
Expand All @@ -20,7 +19,7 @@
from collections import defaultdict

from .utils import *
from .bc_stat import *
from .stat_bc import *
from .cluster import *
from .job import Jobfile
from ._version import __version__
Expand Down Expand Up @@ -267,7 +266,7 @@ def batchStat():
if access_key_secret is None or access_key_id is None:
sys.exit("No access to connect OSS")
client = Client(region, access_key_id, access_key_secret)
logger = Mylog(name=__name__)
logger = getlog(name=__name__)
user = getpass.getuser()
if args.job:
try:
Expand Down
6 changes: 3 additions & 3 deletions src/qsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from . import dag
from .utils import *
from .job import Jobfile
from .sge_run import RunSge
from .run import RunJob
from .config import load_config


class qsub(RunSge):
class qsub(RunJob):

def __init__(self, config=None):
'''
Expand Down Expand Up @@ -107,7 +107,7 @@ def main():
if args.local:
args.mode = "local"
conf.update_dict(**args.__dict__)
logger = Mylog(logfile=args.log, level=args.debug and "debug" or "info")
logger = getlog(logfile=args.log, level=args.debug and "debug" or "info")
qjobs = qsub(config=conf)
try:
qjobs.run(retry=args.resub, ivs=args.resubivs)
Expand Down
8 changes: 4 additions & 4 deletions src/sge_run.py → src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .config import load_config, print_config


class RunSge(object):
class RunJob(object):

def __init__(self, config=None):
'''
Expand Down Expand Up @@ -629,9 +629,9 @@ def main():
args.logdir = "runjob_"+os.path.basename(args.jobfile) + "_log_dir"
args.logdir = os.path.join(args.workdir, args.logdir)
conf.update_dict(**args.__dict__)
logger = Mylog(logfile=args.log,
level="debug" if args.debug else "info", name=__name__)
runsge = RunSge(config=conf)
logger = getlog(logfile=args.log,
level="debug" if args.debug else "info", name=__name__)
runsge = RunJob(config=conf)
try:
runsge.run(retry=args.resub, ivs=args.resubivs)
except (JobFailedError, QsubError):
Expand Down
2 changes: 1 addition & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _run(self):
raise e


def Mylog(logfile=None, level="info", name=None):
def getlog(logfile=None, level="info", name=None):
logger = logging.getLogger(name)
if level.lower() == "info":
logger.setLevel(logging.INFO)
Expand Down

0 comments on commit 5c7b9c0

Please sign in to comment.