1 ##############################################################################
\r
2 # Copyright (c) 2018 Huawei Technologies Co.,Ltd. and others
\r
4 # All rights reserved. This program and the accompanying materials
\r
5 # are made available under the terms of the Apache License, Version 2.0
\r
6 # which accompanies this distribution, and is available at
\r
7 # http://www.apache.org/licenses/LICENSE-2.0
\r
8 ##############################################################################
\r
14 class TaskFile(object):
\r
15 def __init__(self, taskName='task_0'):
\r
16 self._defaultConfFile = self._getFilePath("defaultTaskFile.json")
\r
17 with open(self._defaultConfFile) as defaultConf:
\r
18 self._jsonObj = json.load(defaultConf)
\r
19 self._jsonObj['name'] = taskName
\r
21 def generateFromStep(self, stepObject):
\r
22 self._jsonObj['name'] = stepObject.getName()
\r
23 print "taskFile:", self._jsonObj['name']
\r
24 return self._jsonObj
\r
26 def _getFilePath(self, fileName):
\r
27 dirPath = os.path.dirname(os.path.realpath(__file__))
\r
28 return os.path.join(dirPath, fileName)
\r