示例#1
0
def update_project(ctx, project_file):
    """Update a project."""
    from fulmar.scheduler.projectdb import projectdb
    from fulmar.utils import sha1string
    # TODO: add default dir to put projects
    raw_code = ''
    with open(project_file, 'rb') as f:
        for line in f:
            raw_code += line

    project_id = sha1string(raw_code)
    project_name = project_file.split('/')[-1].strip(' .py')
    data = {
        'project_name': project_name,
        'script': raw_code,
        'project_id': project_id,
        'update_time': time.time()
    }
    projectdb.set(project_name, data)

    click.echo('Successfully update the project "%s".' % project_name)
示例#2
0
 def get_taskid(self, task):
     '''Generate taskid by information of task sha1(url) by default, override me'''
     return sha1string(task['url'])
示例#3
0
 def get_taskid(self, task):
     '''Generate taskid by information of task sha1(url) by default, override me'''
     return sha1string(task['url'])