# Path: modules/fflock_globals.py
# DATABASE_HOST = "192.168.206.133"
# DATABASE_PORT = 3306
# DATABASE_USER = "fflock"
# DATABASE_PASSWD = "fflock"
# DATABASE_NAME = "fflock"
# ENCODER = "ffmpeg"
# NFS_PATH = ""
# SLAVE_MOUNT_PREFIX_PATH = ""
# S3ID = ""
# S3KEY = ""
# S3BUCKET = ""
# CONFIG_FILE = ""
# FETCH_RETRIES = 3
# 
# Path: modules/fflock_utility.py
# def dbconnect():
# def local_ip_address():
# def public_ip_address():
# def ping(address):
# def clear():
# def get_uuid():
# def getFps(file):
# def getTotalFrames(file, fps):
# def ensure_dir(path, storageuuid):
# def get_storage_nfs_folder_path(storageuuid):
# def check_dependencies(jobuuid):
# def remove_dependency_jobs(jobuuid):
# def job_cleanup(jobuuid, storageuuid, masteruuid, jobinput, joboutput):
# def number_of_registered_slaves():
# def number_of_connected_slaves(storageuuid):
# def find_server_storage_UUIDs(serveruuid):
# def find_master_UUID_for_job(uuid):
# def find_job_options_for_job(uuid):
# def find_storage_UUID_for_job():
# def find_server_for_storage_job():
# def find_server_for_slave_job():
# def download_file_http(url, filename):
# def download_file_ftp(url, filename):
# def upload_file_ftp(source, destination):
# def download_file_s3(url, filename):
# def upload_file_s3(source, destination):
# def parse_config_file(configfile, type):
# def submit_job(jobuuid, jobtype, jobsubtype, command, commandpreoptions, commandoptions, input, output, dependencies,
#                masteruuid, joboptions):


import sys
import os
import datetime
from modules import fflock_globals
from modules import fflock_utility
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
from gluon.contrib.login_methods.rpx_account import use_janrain
    Field('Command', 'string'),
    Field('CommandPreOptions', 'string'),
    Field('CommandOptions', 'string'),
    Field('JobInput', 'string'),
    Field('JobOutput', 'string'),
    Field('Assigned', 'integer'),
    Field('State', 'integer'),
    Field('Progress', 'integer'),
    Field('Priority', 'integer'),
    Field('ResultValue1', 'string'),
    Field('ResultValue2', 'string'),
    Field('Dependencies', 'string'),
    Field('UUID', 'string'),
    Field('AssignedServerUUID', 'string'),
    Field('StorageUUID', 'string'),
    Field('MasterUUID', 'string'),
    Field('AssignedTime', 'datetime'),
    Field('CreatedTime', 'datetime'),
    Field('FinishedTime', 'datetime'),
    migrate=False
)


# determine upload location from fflock database
now = datetime.datetime.now()
serveruuid = ""
nfsmountpath = ""
tempdb = fflock_utility.dbconnect()
cursor = tempdb.cursor()
storagecursor = tempdb.cursor()

# Path: modules/fflock_globals.py
# DATABASE_HOST = "192.168.206.133"
# DATABASE_PORT = 3306
# DATABASE_USER = "fflock"
# DATABASE_PASSWD = "fflock"
# DATABASE_NAME = "fflock"
# ENCODER = "ffmpeg"
# NFS_PATH = ""
# SLAVE_MOUNT_PREFIX_PATH = ""
# S3ID = ""
# S3KEY = ""
# S3BUCKET = ""
# CONFIG_FILE = ""
# FETCH_RETRIES = 3
# 
# Path: modules/fflock_utility.py
# def dbconnect():
# def local_ip_address():
# def public_ip_address():
# def ping(address):
# def clear():
# def get_uuid():
# def getFps(file):
# def getTotalFrames(file, fps):
# def ensure_dir(path, storageuuid):
# def get_storage_nfs_folder_path(storageuuid):
# def check_dependencies(jobuuid):
# def remove_dependency_jobs(jobuuid):
# def job_cleanup(jobuuid, storageuuid, masteruuid, jobinput, joboutput):
# def number_of_registered_slaves():
# def number_of_connected_slaves(storageuuid):
# def find_server_storage_UUIDs(serveruuid):
# def find_master_UUID_for_job(uuid):
# def find_job_options_for_job(uuid):
# def find_storage_UUID_for_job():
# def find_server_for_storage_job():
# def find_server_for_slave_job():
# def download_file_http(url, filename):
# def download_file_ftp(url, filename):
# def upload_file_ftp(source, destination):
# def download_file_s3(url, filename):
# def upload_file_s3(source, destination):
# def parse_config_file(configfile, type):
# def submit_job(jobuuid, jobtype, jobsubtype, command, commandpreoptions, commandoptions, input, output, dependencies,
#                masteruuid, joboptions):


# Path: web2py/applications/fflock/models/db.py
import sys
import os
import datetime
from modules import fflock_globals
from modules import fflock_utility
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
from gluon.contrib.login_methods.rpx_account import use_janrain

    Field('Command', 'string'),
    Field('CommandPreOptions', 'string'),
    Field('CommandOptions', 'string'),
    Field('JobInput', 'string'),
    Field('JobOutput', 'string'),
    Field('Assigned', 'integer'),
    Field('State', 'integer'),
    Field('Progress', 'integer'),
    Field('Priority', 'integer'),
    Field('ResultValue1', 'string'),
    Field('ResultValue2', 'string'),
    Field('Dependencies', 'string'),
    Field('UUID', 'string'),
    Field('AssignedServerUUID', 'string'),
    Field('StorageUUID', 'string'),
    Field('MasterUUID', 'string'),
    Field('AssignedTime', 'datetime'),
    Field('CreatedTime', 'datetime'),
    Field('FinishedTime', 'datetime'),
    migrate=False
)


# determine upload location from fflock database
now = datetime.datetime.now()
serveruuid = ""
nfsmountpath = ""
tempdb = fflock_utility.dbconnect()
cursor = tempdb.cursor()
storagecursor = tempdb.cursor()

storagecursor.execute("SELECT ServerType, UUID FROM Servers WHERE ServerType = '%s'" % "Storage")