def download(self, video_url):
     if self._timeout_seconds and 'linux' == platform.system().lower():
         try:
             with time_limit(self._timeout_seconds):
                 self.__download__(video_url)
         except TimeoutException:
             self._driver.quit()
             print("time out")
     else:
         self.__download__(video_url)
Пример #2
0
 def download(self, carousel_url=None):
     if self._timeout_seconds and 'linux' == platform.system().lower():
         try:
             with time_limit(self._timeout_seconds):
                 self.__download__(carousel_url)
         except TimeoutException:
             # close() may cause some problem, change to quit()
             self._driver.quit()
             print("time out")
     else:
         self.__download__(carousel_url)
Пример #3
0
def classify(text):
    try:
        with time_limit(2):
            feat = featurify(text, masterfeats)
            result = classifier.prob_classify(feat)
            probs = dict([(x, result.prob(x)) for x in result.samples()])
            score = probs['pos'] * 2.0 - 1.0
            return score
    except TimeoutException:
        print "Featurify timed out for text %s" % text
        return 0.0
Пример #4
0
def classify(text):
  try:
    with time_limit(2):
      feat = featurify(text, masterfeats)
      result = classifier.prob_classify(feat)
      probs = dict([(x, result.prob(x)) for x in result.samples()])
      score = probs['pos'] * 2.0 - 1.0
      return score
  except TimeoutException:
    print "Featurify timed out for text %s" % text
    return 0.0
Пример #5
0
def ClassifySentiment(text):
    try:
        with time_limit(2):
            feat = CreateFeatures(text, main_features)
            res = classifier.prob_classify(feat)
            probs = dict([(x, res.prob(x)) for x in res.samples()])
            score = probs['pos'] * 2.0 - 1.0
            return score

    except TimeoutException:
        print "Timed out: CreateFeatures for text %s" % text
        return 0.0
        ssh_client = paramiko.SSHClient()
        ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh_client.connect(hostname='80.88.187.155',
                           username='******',
                           password=keyring.get_password("talend", "benemen"))
        stdin, stdout, stderr = ssh_client.exec_command(
            'cd /etl/python_jobs && python error_log_monthly_copier.py')
        today = datetime.today()
        string = "Error Log Successfully stored and reset for {}-{}".format(
            int(today.month) - 1, today.year)
        print(string)

    except Exception as e:
        print("Error occurred:")
        print(e)

    finally:
        if ssh_client:
            ssh_client.close()


if __name__ == "__main__":
    try:
        with time_limit(600):
            main()
    except TimeoutException as e:
        print("Log_Monthly_Backup time has exceeded the safety limit.")
        emailer.raise_error(
            "Log_Monthly_Backup ERROR",
            "The Log_Monthly_Backup execution time has exceeded the 10 minute safety limit"
        )
Пример #7
0
                "EDW required a restart at {}".format(ts),
                "The Autorestart job found the EDW server to be inactive and send the command for a restart as of {}."
                .format(ts))
        else:
            ts = datetime.datetime.now()
            print('Server Active as of %s') % ts

    except Exception as e:
        print("The following error has occurred during your requested process")
        print(e.message)
        emailer.raise_error(
            "EDW Autorestart ERROR",
            "The Autorestart job experienced the following error: {}".format(
                e.message))

    finally:
        if ssh:
            session.close()
            ssh.close()


if __name__ == '__main__':
    try:
        with time_limit(180):
            main(command, server_address, server_username, server_pass)

    except TimeoutException as e:
        print("Execution time has exceeded the safety limit.")
        emailer.raise_error(
            "EDW Autorestart ERROR",
            "The Autorestart job execution time has exceeded the safety limit")
Пример #8
0
sys.path.append("/home/benemenadmin/PyResources") # Directory for Python classes
import time_limit
from time_limit import *
import emailer

ssh_client= None

def main():
	try:
		ssh_client=paramiko.SSHClient()
		ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
		ssh_client.connect(hostname='80.88.187.155',username='******',password=keyring.get_password("talend", "benemen"))
		stdin, stdout, stderr = ssh_client.exec_command("/usr/bin/bash -lc '/etl/cronjobs/60minute_jobs.sh' 1>/dev/null 2>/etl/logs/60minute_jobs.txt")
		out = stdout.read()
		print(out)
	except Exception as e:
		print('The following error has occurred during the XRM_Jobs dkron process')
		print(e.message)
	finally:
		if ssh_client:
			ssh_client.close()
		print('\n60Minute_Jobs complete\n')

			
if __name__ == '__main__':
	try:
		with time_limit(3720):
			main()
	except TimeoutException as e:
		print("60minute_jobs time has exceeded the safety limit.")
		emailer.raise_error("60minute_jobs ERROR","The 60minute_jobs execution time has exceeded the 62 minute safety limit")
Пример #9
0
        ssh_client = paramiko.SSHClient()
        ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh_client.connect(hostname='80.88.187.155',
                           username='******',
                           password=keyring.get_password("talend", "benemen"))
        stdin, stdout, stderr = ssh_client.exec_command(
            "/usr/bin/bash -lc 'cd /etl/talend_jobs ; /etl/cronjobs/minute_jobs.sh' 1>/dev/null 2>/etl/logs/1minute_jobs.txt"
        )
        out = stdout.read()
        print(out)
    except Exception as e:
        print(
            'The following error has occurred during the XRM_Jobs dkron process'
        )
        print(e.message)
    finally:
        if ssh_client:
            ssh_client.close()
        print('\n1Minute_Jobs complete\n')


if __name__ == '__main__':
    try:
        with time_limit(120):
            main()
    except TimeoutException as e:
        print("1minute_jobs time has exceeded the safety limit.")
        emailer.raise_error(
            "1minute_jobs ERROR",
            "The 1minute_jobs execution time has exceeded the 2 minute safety limit"
        )
Пример #10
0
        ssh_client = paramiko.SSHClient()
        ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh_client.connect(hostname='80.88.187.155',
                           username='******',
                           password=keyring.get_password("talend", "benemen"))
        stdin, stdout, stderr = ssh_client.exec_command(
            "/usr/bin/bash -lc '/etl/cronjobs/5minute_jobs.sh' 1>/dev/null 2>/etl/logs/5minute_jobs.txt"
        )
        out = stdout.read()
        print(out)
    except Exception as e:
        print(
            'The following error has occurred during the XRM_Jobs dkron process'
        )
        print(e.message)
    finally:
        if ssh_client:
            ssh_client.close()
        print('\n5Minute_Jobs complete\n')


if __name__ == '__main__':
    try:
        with time_limit(360):
            main()
    except TimeoutException as e:
        print("5minute_jobs time has exceeded the safety limit.")
        emailer.raise_error(
            "1minute_jobs ERROR",
            "The 5minute_jobs execution time has exceeded the 6 minute safety limit"
        )
Пример #11
0
import sshgit_talend_jobs
import sshgit_etl_development
import sshgit_etl_BeneDW
import sshgit_QlikSense_BeneReports_development
import sshgit_QlikSense_BeneReports_production
import sshgit_esb_beneesb
import git_dkron
import sys
sys.path.append("/home/benemenadmin/PyResources") # Directory for Python classes
import time_limit
from time_limit import *
import emailer

def main():
	
	git_BAP.main()
	git_dkron.main()
	sshgit_talend_jobs.main()
	sshgit_etl_development.main()
	sshgit_etl_BeneDW.main()
	sshgit_QlikSense_BeneReports_development.main()
	sshgit_QlikSense_BeneReports_production.main()
	sshgit_esb_beneesb.main()
		
if __name__ == '__main__':
	try:
		with time_limit(300):
			main()
	except TimeoutException as e:
		print("Auto Gitlab Uploader time has exceeded the safety limit.")
		emailer.raise_error("Auto Gitlab Uploader ERROR","Auto Gitlab Uploader execution time has exceeded the 5 minute safety limit")
Пример #12
0
        ssh_client = paramiko.SSHClient()
        ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh_client.connect(hostname='80.88.187.155',
                           username='******',
                           password=keyring.get_password("talend", "benemen"))
        stdin, stdout, stderr = ssh_client.exec_command(
            "/usr/bin/bash -lc '/etl/cronjobs/15minute_jobs.sh' 1>/dev/null 2>/etl/logs/15minute_jobs.txt"
        )
        out = stdout.read()
        print(out)
    except Exception as e:
        print(
            'The following error has occurred during the XRM_Jobs dkron process'
        )
        print(e.message)
    finally:
        if ssh_client:
            ssh_client.close()
        print('\n15Minute_Jobs complete\n')


if __name__ == '__main__':
    try:
        with time_limit(960):
            main()
    except TimeoutException as e:
        print("15minute_jobs time has exceeded the safety limit.")
        emailer.raise_error(
            "15minute_jobs ERROR",
            "The 15minute_jobs execution time has exceeded the 16 minute safety limit"
        )
Пример #13
0
        ssh_client = paramiko.SSHClient()
        ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh_client.connect(hostname='80.88.187.155',
                           username='******',
                           password=keyring.get_password("talend", "benemen"))
        stdin, stdout, stderr = ssh_client.exec_command(
            "/usr/bin/bash -lc '/etl/cronjobs/20minute_jobs.sh' 1>/dev/null 2>/etl/logs/20minute_jobs.txt"
        )
        out = stdout.read()
        print(out)
    except Exception as e:
        print(
            'The following error has occurred during the XRM_Jobs dkron process'
        )
        print(e.message)
    finally:
        if ssh_client:
            ssh_client.close()
        print('\n20Minute_Jobs complete\n')


if __name__ == '__main__':
    try:
        with time_limit(1260):
            main()
    except TimeoutException as e:
        print("20minute_jobs time has exceeded the safety limit.")
        emailer.raise_error(
            "20minute_jobs ERROR",
            "The 20minute_jobs execution time has exceeded the 21 minute safety limit"
        )