# limitations under the License.
import logging
import traceback
+import os
from lcm.pub.database.models import WFPlanModel
from lcm.pub.msapi import activiti
logger = logging.getLogger(__name__)
+
def deploy_workflow_on_startup():
try:
if WFPlanModel.objects.filter():
logger.warn("Workflow is already deployed.")
return
- file_path = "TODO:"
+ base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ file_path = os.path.join(base_path, "ns/data/nsinit.bpmn20.xml")
deploy_info = activiti.deploy_workflow(file_path)
WFPlanModel(
- deployed_id=deploy_info["deployedId"],
- process_id=deploy_info["processId"],
+ deployed_id=deploy_info["deployedId"],
+ process_id=deploy_info["processId"],
status=deploy_info["status"],
message=deploy_info["message"],
plan_name="ns_instantiate").save()
logger.info("Deploy workflow successfully.")
except:
logger.error(traceback.format_exc())
-