from flask import Flask
import cm_generate_command
app = Flask(__name__)

@app.route('/start')
def start():
	return 'Starting Mongo'

@app.route('/stop')
def stop():
	return 'Stopping Mongo'

@app.route('/info')
def info():
	return 'Showing info'

@app.route('/connect')
def connect():
	return 'Connecting to DB'

@app.route('/modify')
def modify():
	return 'Modifying'

@app.route('/add')
def add():
	return 'adding'

@app.route('/insert')
def insertJob():
	return 'Inserting Job'

@app.route('/find')
def findJobs():
	return 'finding jobs'

@app.route('/delete')
def delete():
	return 'Deleting jobs'

@app.route('/Count')
def startMongo():
	return 'counting jobs'

@app.route('/update_job_end_time')
def update_job_end_time():
	return 'Starting update_job_end_time'

@app.route('/updateJobAttributes')
def updateJobAttributes():
	return 'Starting updateJobAttributes'

@app.route('/jobStatusStats')
def jobStatusStats():
	return 'Starting jobStatusStats'

if __name__ == '__main__':
    app.run()
from flask import Flask, request
from flask_restful import Resource, Api, reqparse
from cloudmesh_job.cm_jobdb import JobDB

app = Flask(__name__)
api = Api(app)

db = JobDB()

'''will insert job by job_id'''
class Insert(Resource):
    def put(self, args_job_name):
	db.insert(args_job_name)
	print "will now search for job, if properly inserted, will print out value"
        return db.find_jobs({"job_name" : args_job_name})

class Delete(Resource):
    def delete(self, args_job_name):
	'''if job exists, delete'''
        if db.find_jobs(args_job_name): 
		db.delete(args_job_name)
		return Console.ok("job has been deleted")
	else:
		return Console.ok("Job not found")

api.add_resource(Insert, '/insert/<string:job_name>')
api.add_resource(Delete, '/delete/<string:job_name>')

'''debug should not be in production code'''
if __name__ == '__main__':
    app.run(debug=True) 

Update job_server.py