示例#1
0
    def test_cli_deployment_with_default_configuration_can_produce_results(self):
        run_process(["python", "-m", "foundations", "init", "test-cli-init"], '.')
        self._append_redis_job_id_log_to_driver_file()
        driver_deploy_output = self._deploy_job_file('test-cli-init', entrypoint='main.py')
        job_id = self.redis.get('foundations_testing_job_id').decode()

        self._assert_job_file_exists(job_id, 'miscellaneous/job_artifact_listing.pkl')
示例#2
0
    def test_cli_can_deploy_job_created_by_init(self):
        import subprocess

        run_process(["python", "-m", "foundations", "init", "test-cli-init"], '.')
        driver_deploy_exit_code = subprocess.call(["/bin/bash", "-c", "cd test-cli-init && python main.py"])

        self.assertEqual(driver_deploy_exit_code, 0)
    def test_save_artifact_outside_of_job_logs_warning(self):
        from foundations_spec.extensions import run_process

        process_output = run_process(['python', 'main.py'],
                                     'acceptance/fixtures/save_artifact')
        self.assertIn('WARNING', process_output)
        self.assertIn('Cannot save artifact outside of job.', process_output)
    def _deploy_job_file(self, path, job_id=None, entrypoint='main.py'):
        from foundations_spec.extensions import run_process

        if job_id is None:
            job_id = self.job_id

        self._set_home_directory()
        return run_process(
            ['python', entrypoint],
            path,
            environment={
                'FOUNDATIONS_HOME': self.foundations_home,
                'FOUNDATIONS_JOB_ID': job_id,
                'FOUNDATIONS_COMMAND_LINE': 'False'
            })