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