Auto_Jobs_Applier_AI_Agent by AIHawk is an AI Agent that automates the jobs application process. Utilizing artificial intelligence, it enables users to apply for multiple jobs in an automated and personalized way.
This guide will help you set up and run the Auto_Jobs_Applier_AIHawk project on a Windows machine using Ubuntu via Windows Subsystem for Linux (WSL). We'll walk through installing Ubuntu, setting up the development environment, installing Chrome and Chromedriver, configuring the project, modifying the code to remove interactive prompts, automating script execution, and running the application.
Navigate to the directory containing the manager_facade.py file:
cd virtual/lib/python3.10/site-packages/lib_resume_builder_AIHawk/
Edit the manager_facade.py File:
Open the file using VS Code or a text editor:
code utils.py
Modificar o Caminho Executável do ChromeService
Localize a função choose_style e assegure-se de que ela aponte para o caminho correto do ChromeDriver sem a extensão .exe.
Antes (Função Original):
service = ChromeService(executable_path=chromedriver_path)
Depois (Função Modificada):
service = ChromeService(executable_path="/path/to/chromedriver")
Save the Changes:
In VS Code, press Ctrl + S to save.
Exit the editor if desired.
Modify the Code to Remove Interactive Prompt
To ensure that the script runs automatically without waiting for user input, we need to modify the choose_style function to select a default style programmatically.
Navigate to the directory containing the manager_facade.py file:
cd virtual/lib/python3.10/site-packages/lib_resume_builder_AIHawk/
Edit the manager_facade.py File:
Open the file using VS Code or a text editor:
code manager_facade.py
Modify choose_style function arround line 52:
Before (Original Function):
def choose_style(self):
styles = self.style_manager.get_styles()
if not styles:
print("No styles available")
return None
final_style_choice = "Create your resume style in CSS"
formatted_choices = self.style_manager.format_choices(styles)
formatted_choices.append(final_style_choice)
selected_choice = self.prompt_user(formatted_choices, "Which style would you like to adopt?")
if selected_choice == final_style_choice:
tutorial_url = "https://github.com/feder-cr/lib_resume_builder_AIHawk/blob/main/how_to_contribute/web_designer.md"
print("\nOpening tutorial in your browser...")
webbrowser.open(tutorial_url)
exit()
else:
self.selected_style = selected_choice.split(' (')[0]
After (Modified Function) Option1:
def choose_style(self):
styles = self.style_manager.get_styles()
if not styles:
print("No styles available")
return None
final_style_choice = "Create your resume style in CSS"
formatted_choices = self.style_manager.format_choices(styles)
formatted_choices.append(final_style_choice)
# **Automate Style Selection:**
# Select a default style without prompting the user.
# You can choose to select the first available style or specify a particular one.
# **Option 1: Select the First Available Style**
if formatted_choices:
selected_choice = formatted_choices[0] # Automatically select the first style
print(f"Selected default style: {selected_choice}")
else:
selected_choice = final_style_choice
After (Modified Function) Option 2:
def choose_style(self):
styles = self.style_manager.get_styles()
if not styles:
print("No styles available")
return None
final_style_choice = "Create your resume style in CSS"
formatted_choices = self.style_manager.format_choices(styles)
formatted_choices.append(final_style_choice)
# **Automate Style Selection:**
# Select a default style without prompting the user.
# You can choose to select the first available style or specify a particular one.
# **Option 2: Specify a Particular Default Style**
# Uncomment and modify the following lines if you prefer a specific style.
# default_style_name = "Default (style author -> https://github.com/krishnavalliappan)"
# if default_style_name in formatted_choices:
# selected_choice = default_style_name
# print(f"Selected default style: {selected_choice}")
# else:
# selected_choice = formatted_choices[0] # Fallback to first style
# print(f"Default style not found. Selected first available style: {selected_choice}")
if selected_choice == final_style_choice:
tutorial_url = "https://github.com/feder-cr/lib_resume_builder_AIHawk/blob/main/how_to_contribute/web_designer.md"
print("\nOpening tutorial in your browser...")
webbrowser.open(tutorial_url)
exit()
else:
self.selected_style = selected_choice.split(' (')[0]
print(f"Resume will be generated using the '{self.selected_style}' style.")
Explanation of Changes:
Removed Interactive Prompt:
The self.prompt_user function call has been removed to prevent the script from waiting for user input.
Automate Style Selection:
Option 1: Automatically selects the first available style from the formatted_choices list.
Option 2 (Commented Out): Allows you to specify a particular default style by name. Uncomment and modify as needed.
Note: Choose either Option 1 or Option 2 based on your preference. If you have a preferred default style, Option 2 offers more control.
Add Your Resume PDF
Create a Directory for Resumes (If Not Exists):
mkdir -p resumes
Place Your Resume PDF in the resumes Directory:
cp /path/to/your_resume.pdf resumes/
Replace /path/to/your_resume.pdf with the actual path to your resume file.
Or simple move using mouse in VSC.
Update Configuration Files
Ensure that the configuration files secrets.yaml, config.yaml, and plain_text_resume.yaml are properly configured with your specific details.
To ensure that the Auto_Jobs_Applier_AIHawk script runs automatically every hour without manual intervention, we'll set up a cron job. This involves creating a shell script to activate the virtual environment and run the Python script, making the script executable, and scheduling it with cron.
To ensure that the Python script runs within the correct environment, we'll create a shell script that activates the virtual environment and executes the script.
Navigate to the Project Directory:
cd ~/Auto_Jobs_Applier_AIHawk
Create a New Shell Script File:
Let's name the script run_auto_jobs.sh.
nano run_auto_jobs.sh
Add the Following Content to the Script:
Replace /home/proteusbr/Auto_Jobs_Applier_AIHawk with the actual path to your project directory if it's different.
#!/bin/bash
# Navigate to the project directory
cd /home/proteusbr/Auto_Jobs_Applier_AIHawk
# Activate the virtual environment
source virtual/bin/activate
# Run the Python script with the default style
python main.py --resume resume-job.pdf
# Deactivate the virtual environment
deactivate
Explanation:
Shebang (#!/bin/bash): Specifies that the script should be run in the Bash shell.
cd: Navigates to the project directory.
source virtual/bin/activate: Activates the Python virtual environment.
python main.py --resume resume-job.pdf: Executes the Python script with the specified resume.
deactivate: Deactivates the virtual environment after the script completes.
Save and Exit the Editor:
Press Ctrl + O, then Enter to save.
Press Ctrl + X to exit.
2. Make the Shell Script Executable
To allow the script to be run, grant it execute permissions.
chmod +x run_auto_jobs.sh
3. Set Up the Cron Job
Cron is a time-based job scheduler in Unix-like operating systems. We'll configure it to run the shell script every hour.
Open the Crontab Editor:
crontab -e
First-Time Setup: If prompted to choose an editor, select your preferred one (e.g., nano).
Add the Cron Job Entry:
At the end of the crontab file, add the following line:
Cron jobs run in a limited environment. Ensure that any necessary environment variables are set within the shell script.
For example, in run_auto_jobs.sh, you can set environment variables before activating the virtual environment:
#!/bin/bash
# Redireciona toda a saída para cron.log
exec >> /home/proteusbr/Auto_Jobs_Applier_AIHawk/cron.log 2>&1
# Insere um timestamp
echo "----- $(date) -----"
# Define a variável de ambiente TERM
export TERM=xterm
# Navega para o diretório do projeto
cd /home/proteusbr/Auto_Jobs_Applier_AIHawk || { echo "Failed to navigate to project directory"; exit 1; }
# Ativa o ambiente virtual
source virtual/bin/activate || { echo "Failed to activate virtual environment"; exit 1; }
# Executa o script Python principal usando o caminho absoluto
/home/proteusbr/Auto_Jobs_Applier_AIHawk/virtual/bin/python main.py --resume resume-job.pdf || { echo "Python main script failed"; exit 1; }
# Desativa o ambiente virtual
deactivate
echo "Script executed successfully."
Review the cron.log for any error messages that can provide insights into what might be going wrong.
Modify the Code to Remove Interactive Prompt
To ensure that the script runs automatically without waiting for user input, we need to modify the choose_style function to select a default style programmatically.
📄 Original choose_style Function:
Located in ./virtual/lib/python3.10/site-packages/lib_resume_builder_AIHawk/manager_facade.py at line 52.
def choose_style(self):
styles = self.style_manager.get_styles()
if not styles:
print("No styles available")
return None
final_style_choice = "Create your resume style in CSS"
formatted_choices = self.style_manager.format_choices(styles)
formatted_choices.append(final_style_choice)
selected_choice = self.prompt_user(formatted_choices, "Which style would you like to adopt?")
if selected_choice == final_style_choice:
tutorial_url = "https://github.com/feder-cr/lib_resume_builder_AIHawk/blob/main/how_to_contribute/web_designer.md"
print("\nOpening tutorial in your browser...")
webbrowser.open(tutorial_url)
exit()
else:
self.selected_style = selected_choice.split(' (')[0]
🛠️ Modified choose_style Function:
def choose_style(self):
styles = self.style_manager.get_styles()
if not styles:
print("No styles available")
return None
final_style_choice = "Create your resume style in CSS"
formatted_choices = self.style_manager.format_choices(styles)
formatted_choices.append(final_style_choice)
# **Automate Style Selection:**
# Select a default style without prompting the user.
# You can choose to select the first available style or specify a particular one.
# **Option 1: Select the First Available Style**
if formatted_choices:
selected_choice = formatted_choices[0] # Automatically select the first style
print(f"Selected default style: {selected_choice}")
else:
selected_choice = final_style_choice
# **Option 2: Specify a Particular Default Style**
# Uncomment and modify the following lines if you prefer a specific style.
# default_style_name = "Default (style author -> https://github.com/krishnavalliappan)"
# if default_style_name in formatted_choices:
# selected_choice = default_style_name
# print(f"Selected default style: {selected_choice}")
# else:
# selected_choice = formatted_choices[0] # Fallback to first style
# print(f"Default style not found. Selected first available style: {selected_choice}")
if selected_choice == final_style_choice:
tutorial_url = "https://github.com/feder-cr/lib_resume_builder_AIHawk/blob/main/how_to_contribute/web_designer.md"
print("\nOpening tutorial in your browser...")
webbrowser.open(tutorial_url)
exit()
else:
self.selected_style = selected_choice.split(' (')[0]
print(f"Resume will be generated using the '{self.selected_style}' style.")
Explanation of Changes:
Removed Interactive Prompt:
The self.prompt_user function call has been removed to prevent the script from waiting for user input.
Automate Style Selection:
Option 1: Automatically selects the first available style from the formatted_choices list.
Option 2 (Commented Out): Allows you to specify a particular default style by name. Uncomment and modify as needed.
Feedback Messages:
Added print statements to inform which style has been selected automatically. This is useful for logging and debugging purposes.
Maintain Functionality:
The rest of the function remains unchanged to ensure that if the final_style_choice is selected, it behaves as intended (opens the tutorial and exits).
Recommendation: If you have a preferred default style, Option 2 offers more control and ensures consistency. Otherwise, Option 1 is sufficient for general automation purposes.
Automate Script Execution with Cron
To ensure that the Auto_Jobs_Applier_AIHawk script runs automatically every hour without manual intervention, we'll set up a cron job. This involves creating a shell script to activate the virtual environment and run the Python script, making the script executable, and scheduling it with cron.
To ensure that the Python script runs within the correct environment, we'll create a shell script that activates the virtual environment and executes the script.
Navigate to the Project Directory:
cd ~/Auto_Jobs_Applier_AIHawk
Create a New Shell Script File:
Let's name the script run_auto_jobs.sh.
nano run_auto_jobs.sh
Add the Following Content to the Script:
Replace /home/proteusbr/Auto_Jobs_Applier_AIHawk with the actual path to your project directory if it's different.
#!/bin/bash
# Navigate to the project directory
cd /home/proteusbr/Auto_Jobs_Applier_AIHawk
# Activate the virtual environment
source virtual/bin/activate
# Run the Python script with the default style
python main.py --resume resume-job.pdf
# Deactivate the virtual environment
deactivate
Explanation:
Shebang (#!/bin/bash): Specifies that the script should be run in the Bash shell.
cd: Navigates to the project directory.
source virtual/bin/activate: Activates the Python virtual environment.
python main.py --resume resume-job.pdf: Executes the Python script with the specified resume.
deactivate: Deactivates the virtual environment after the script completes.
Save and Exit the Editor:
Press Ctrl + O, then Enter to save.
Press Ctrl + X to exit.
2. Make the Shell Script Executable
To allow the script to be run, grant it execute permissions.
chmod +x run_auto_jobs.sh
Test:
./run_auto_jobs.sh
3. Set Up the Cron Job
Cron is a time-based job scheduler in Unix-like operating systems. We'll configure it to run the shell script every hour.
Open the Crontab Editor:
crontab -e
First-Time Setup: If prompted to choose an editor, select your preferred one (e.g., nano).
Add the Cron Job Entry:
At the end of the crontab file, add the following line:
This command continuously displays new log entries as they are appended.
Tips:
Successful Execution: Look for log entries indicating that the script ran without errors, such as confirmation of the selected style and successful resume generation.
Errors: If errors are present, they will be logged here. Use these logs to troubleshoot issues.
6. Troubleshooting
If the cron job isn't executing as expected, consider the following troubleshooting steps:
a. Check Cron Service Status
Ensure that the cron service is running.
sudo service cron status
If Not Running: Start the cron service.
sudo service cron start
b. Verify Script Paths and Permissions
Absolute Paths: Ensure that all paths in the shell script are absolute.
Execute Permissions: Confirm that the shell script and chromedriver have execute permissions.
ls -l /home/proteusbr/Auto_Jobs_Applier_AIHawk/run_auto_jobs.sh
ls -l /usr/local/bin/chromedriver
Cron jobs run in a limited environment. Ensure that any necessary environment variables are set within the shell script.
For example, in run_auto_jobs.sh, you can set environment variables before activating the virtual environment:
#!/bin/bash
# Set environment variables if needed
export SOME_ENV_VAR="value"
# Navigate to the project directory
cd /home/proteusbr/Auto_Jobs_Applier_AIHawk
# Activate the virtual environment
source virtual/bin/activate
# Run the Python script
python main.py --resume resume-job.pdf
# Deactivate the virtual environment
deactivate
d. Script Output
Review the cron.log for any error messages that can provide insights into what might be going wrong.
Run the Application
With all dependencies installed, configurations set, and automation in place, you can now run the application.
Ensure the Virtual Environment is Activated:
source virtual/bin/activate
Navigate to the Project Directory (If Not Already There):
cd Auto_Jobs_Applier_AIHawk
Run the Main Script with Your Resume:
python main.py --resume resumes/your_resume.pdf
Replace resumes/your_resume.pdf with the path to your resume PDF.
Expected Outcome:
The script should execute without asking for style selection.
The resume should be generated using the selected default style.
Logs should indicate successful execution.
Example Output:
Selected default style: Clean Blue (style author -> https://github.com/samodum)
Resume will be generated using the 'Clean Blue' style.
Troubleshooting
If you encounter any issues during setup or execution, consider the following troubleshooting steps:
1. Chromedriver Not Found or Incorrect Version
Ensure ChromeDriver Version Matches Chrome Version:
Verify that the ChromeDriver version matches your installed Google Chrome version.
google-chrome --version
chromedriver --version
Re-download ChromeDriver if Versions Mismatch:
If there's a mismatch, download the correct version from the Chrome for Testing site.
2. Permissions Issues
Grant Execute Permissions:
sudo chmod +x /usr/local/bin/chromedriver
3. Virtual Environment Issues
Activate Virtual Environment:
source virtual/bin/activate
Reinstall Dependencies:
pip install -r requirements.txt
4. Configuration Errors
Double-Check Configuration Files:
Ensure that secrets.yaml, config.yaml, and plain_text_resume.yaml have the correct paths and credentials.
5. Selenium Errors
Check Selenium and WebDriver Installation:
Ensure that both Selenium and ChromeDriver are correctly installed and accessible.
Specify ChromeDriver Path Explicitly:
If Selenium cannot locate ChromeDriver, specify the path explicitly in your scripts as shown in the Fixing a Known Bug section.
6. General Debugging
Use Logging Outputs:
Check the logs for detailed error messages to identify where the issue is occurring.
By following this step-by-step guide, you have successfully set up and configured the Auto_Jobs_Applier_AIHawk project on your Windows machine using Ubuntu via WSL. The modifications to remove interactive prompts and the setup of a cron job ensure that your application runs automatically every hour, streamlining your job application process.
Summary of Steps:
Install Ubuntu via WSL and Update It.
Install Visual Studio Code with the Remote - WSL Extension.
Clone the Repository and Set Up a Python Virtual Environment.
Install Project Dependencies, Google Chrome, and ChromeDriver.
Fix Known Bugs by Modifying the Code to Remove Interactive Prompts.
Add Your Resume PDF and Update Configuration Files.
Create a Shell Script and Set Up a Cron Job to Automate Execution.
Run and Monitor the Application.
If you continue to experience issues, please refer to the troubleshooting section or reach out to the project maintainers for further assistance.
Good luck with your automated job applications! 🚀
Additional Tips
Use Environment Variables for Secrets:
For enhanced security, consider using environment variables to store sensitive information like LinkedIn credentials instead of hardcoding them in secrets.yaml.
Keep Software Updated:
Regularly update your system packages, Google Chrome, and ChromeDriver to ensure compatibility and security.
Backup Configuration Files:
Before making significant changes, back up your configuration files to prevent data loss.
Virtual Environment Management:
If you encounter issues with the virtual environment, consider deleting and recreating it to ensure a clean setup.
Auto_Jobs_Applier_AIHawk Installation Guide
This guide will help you set up and run the Auto_Jobs_Applier_AIHawk project on a Windows machine using Ubuntu via Windows Subsystem for Linux (WSL). We'll walk through installing Ubuntu, setting up the development environment, installing Chrome and Chromedriver, configuring the project, modifying the code to remove interactive prompts, automating script execution, and running the application.
Table of Contents
Prerequisites
Before proceeding, ensure you have the following:
Install Ubuntu via Microsoft Store
Enable WSL (Windows Subsystem for Linux):
Open PowerShell as an administrator and run:
This command installs WSL and the latest Ubuntu distribution by default. If you already have WSL enabled, you can skip this step.
Restart Your Computer:
After enabling WSL, restart your computer if prompted.
Install Ubuntu:
Update and Upgrade Ubuntu
After installing Ubuntu, update the package lists and upgrade installed packages to ensure you have the latest updates.
Open the Ubuntu Terminal.
Run the Following Commands:
Install Visual Studio Code on Windows
Download Visual Studio Code (VS Code):
Visit the Visual Studio Code website and download the installer for Windows.
Install VS Code:
Run the downloaded installer and follow the installation prompts.
Install the Remote - WSL Extension:
Ctrl+Shift+X
.This extension allows you to work seamlessly with your WSL environment directly from VS Code.
Clone the Repository
Open Visual Studio Code.
Open the WSL Terminal within VS Code:
Clone the Repository:
Navigate to the Project Directory:
Set Up Python Virtual Environment
Creating a virtual environment ensures that project dependencies are isolated from other projects.
Create a Virtual Environment Named
virtual
:Activate the Virtual Environment:
You should see
(virtual)
prefixed in your terminal prompt, indicating that the virtual environment is active.Install Project Dependencies
With the virtual environment activated, install the required Python packages.
Install Dependencies from
requirements.txt
:Ensure that the
requirements.txt
file exists in the project directory and lists all necessary packages.Install Google Chrome
Download the Google Chrome Debian Package:
Install the Package:
Fix Any Dependency Issues:
If you encounter dependency errors during installation, run:
Verify the Installation:
Expected Output:
Install ChromeDriver
To ensure compatibility between Chrome and ChromeDriver, download the ChromeDriver version that matches your installed version of Google Chrome.
Check Your Google Chrome Version:
Example Output:
Download the Corresponding ChromeDriver:
Visit the Chrome for Testing page to find the appropriate ChromeDriver version.
Example for Version 129.0.6668.70:
Install Unzip (If Not Already Installed):
Extract the Downloaded ZIP File:
Move ChromeDriver to a Directory in PATH:
Grant Execute Permissions to ChromeDriver:
Verify ChromeDriver Installation:
Expected Output:
Ensure ChromeDriver is Accessible:
Expected Output:
Fixing a Known Bug
There is a known issue in the project where ChromeDriver is incorrectly referenced with a
.exe
extension in a Linux environment. To fix this:Locate the
utils.py
File:The file path provided seems to be:
Navigate to the directory containing the
manager_facade.py
file:Edit the
manager_facade.py
File:Open the file using VS Code or a text editor:
Modificar o Caminho Executável do ChromeService
Localize a função
choose_style
e assegure-se de que ela aponte para o caminho correto do ChromeDriver sem a extensão.exe
.Antes (Função Original):
Depois (Função Modificada):
Save the Changes:
Ctrl + S
to save.Modify the Code to Remove Interactive Prompt
To ensure that the script runs automatically without waiting for user input, we need to modify the
choose_style
function to select a default style programmatically.Locate the
utils.py
File:The file path provided seems to be:
Navigate to the directory containing the
manager_facade.py
file:Edit the
manager_facade.py
File:Open the file using VS Code or a text editor:
Modify choose_style function arround line 52:
Before (Original Function):
After (Modified Function) Option1:
After (Modified Function) Option 2:
Explanation of Changes:
Removed Interactive Prompt:
self.prompt_user
function call has been removed to prevent the script from waiting for user input.Automate Style Selection:
formatted_choices
list.Note: Choose either Option 1 or Option 2 based on your preference. If you have a preferred default style, Option 2 offers more control.
Add Your Resume PDF
Create a Directory for Resumes (If Not Exists):
Place Your Resume PDF in the
resumes
Directory:Replace
/path/to/your_resume.pdf
with the actual path to your resume file.Or simple move using mouse in VSC.
Update Configuration Files
Ensure that the configuration files
secrets.yaml
,config.yaml
, andplain_text_resume.yaml
are properly configured with your specific details.Open Each Configuration File in VS Code:
Update the Necessary Fields:
Save the Changes.
Automate Script Execution with Cron
To ensure that the Auto_Jobs_Applier_AIHawk script runs automatically every hour without manual intervention, we'll set up a cron job. This involves creating a shell script to activate the virtual environment and run the Python script, making the script executable, and scheduling it with cron.
📋 Table of Contents
1. Create a Shell Script to Run the Python Script
To ensure that the Python script runs within the correct environment, we'll create a shell script that activates the virtual environment and executes the script.
Navigate to the Project Directory:
Create a New Shell Script File:
Let's name the script
run_auto_jobs.sh
.Add the Following Content to the Script:
Replace
/home/proteusbr/Auto_Jobs_Applier_AIHawk
with the actual path to your project directory if it's different.Explanation:
#!/bin/bash
): Specifies that the script should be run in the Bash shell.cd
: Navigates to the project directory.source virtual/bin/activate
: Activates the Python virtual environment.python main.py --resume resume-job.pdf
: Executes the Python script with the specified resume.deactivate
: Deactivates the virtual environment after the script completes.Save and Exit the Editor:
Ctrl + O
, thenEnter
to save.Ctrl + X
to exit.2. Make the Shell Script Executable
To allow the script to be run, grant it execute permissions.
3. Set Up the Cron Job
Cron is a time-based job scheduler in Unix-like operating systems. We'll configure it to run the shell script every hour.
Open the Crontab Editor:
nano
).Add the Cron Job Entry:
At the end of the crontab file, add the following line:
Explanation:
0 * * * *
: Specifies that the job runs at minute0
of every hour./home/proteusbr/Auto_Jobs_Applier_AIHawk/run_auto_jobs.sh
: Full path to the shell script.>> /home/proteusbr/Auto_Jobs_Applier_AIHawk/cron.log 2>&1
: Redirects both standard output and errors tocron.log
for logging purposes.Save and Exit the Crontab Editor:
nano
, pressCtrl + O
,Enter
to save.Ctrl + X
to exit.4. Verify the Cron Job
To ensure that the cron job has been added successfully:
Expected Output:
This confirms that the cron job is scheduled to run hourly.
5. Monitor Cron Job Logs
Regularly check the
cron.log
file to monitor the execution of your script and identify any potential issues.View the Last Few Entries:
Follow the Log in Real-Time:
Tips:
./Auto_Jobs_Applier_AIHawk/app_config.py MINIMUM_WAIT_TIME = 5
./Auto_Jobs_Applier_AIHawk/src/utils.py def chrome_browser_options(): options.add_argument("--headless")
./Auto_Jobs_Applier_AIHawk/src/aihawk_job_manager.py timeout=0
6. Troubleshooting
If the cron job isn't executing as expected, consider the following troubleshooting steps:
a. Check Cron Service Status
Ensure that the cron service is running.
If Not Running: Start the cron service.
b. Verify Script Paths and Permissions
Execute Permissions: Confirm that the shell script and
chromedriver
have execute permissions.Expected Output:
c. Environment Variables
Cron jobs run in a limited environment. Ensure that any necessary environment variables are set within the shell script.
For example, in
run_auto_jobs.sh
, you can set environment variables before activating the virtual environment:./Auto_Jobs_Applier_AIHawk/app_config.py MINIMUM_WAIT_TIME = 5
./Auto_Jobs_Applier_AIHawk/src/utils.py def chrome_browser_options(): options.add_argument("--headless")
./Auto_Jobs_Applier_AIHawk/src/aihawk_job_manager.py timeout=0
d. Script Output
Review the
cron.log
for any error messages that can provide insights into what might be going wrong.Modify the Code to Remove Interactive Prompt
To ensure that the script runs automatically without waiting for user input, we need to modify the
choose_style
function to select a default style programmatically.📄 Original
choose_style
Function:Located in
./virtual/lib/python3.10/site-packages/lib_resume_builder_AIHawk/manager_facade.py
at line 52.🛠️ Modified
choose_style
Function:Explanation of Changes:
Removed Interactive Prompt:
self.prompt_user
function call has been removed to prevent the script from waiting for user input.Automate Style Selection:
formatted_choices
list.Feedback Messages:
print
statements to inform which style has been selected automatically. This is useful for logging and debugging purposes.Maintain Functionality:
final_style_choice
is selected, it behaves as intended (opens the tutorial and exits).Recommendation: If you have a preferred default style, Option 2 offers more control and ensures consistency. Otherwise, Option 1 is sufficient for general automation purposes.
Automate Script Execution with Cron
To ensure that the Auto_Jobs_Applier_AIHawk script runs automatically every hour without manual intervention, we'll set up a cron job. This involves creating a shell script to activate the virtual environment and run the Python script, making the script executable, and scheduling it with cron.
📋 Table of Contents
1. Create a Shell Script to Run the Python Script
To ensure that the Python script runs within the correct environment, we'll create a shell script that activates the virtual environment and executes the script.
Navigate to the Project Directory:
Create a New Shell Script File:
Let's name the script
run_auto_jobs.sh
.Add the Following Content to the Script:
Replace
/home/proteusbr/Auto_Jobs_Applier_AIHawk
with the actual path to your project directory if it's different.Explanation:
#!/bin/bash
): Specifies that the script should be run in the Bash shell.cd
: Navigates to the project directory.source virtual/bin/activate
: Activates the Python virtual environment.python main.py --resume resume-job.pdf
: Executes the Python script with the specified resume.deactivate
: Deactivates the virtual environment after the script completes.Save and Exit the Editor:
Ctrl + O
, thenEnter
to save.Ctrl + X
to exit.2. Make the Shell Script Executable
To allow the script to be run, grant it execute permissions.
Test:
3. Set Up the Cron Job
Cron is a time-based job scheduler in Unix-like operating systems. We'll configure it to run the shell script every hour.
Open the Crontab Editor:
nano
).Add the Cron Job Entry:
At the end of the crontab file, add the following line:
Explanation:
0 * * * *
: Specifies that the job runs at minute0
of every hour./home/proteusbr/Auto_Jobs_Applier_AIHawk/run_auto_jobs.sh
: Full path to the shell script.>> /home/proteusbr/Auto_Jobs_Applier_AIHawk/cron.log 2>&1
: Redirects both standard output and errors tocron.log
for logging purposes.Save and Exit the Crontab Editor:
nano
, pressCtrl + O
,Enter
to save.Ctrl + X
to exit.4. Verify the Cron Job
To ensure that the cron job has been added successfully:
Expected Output:
This confirms that the cron job is scheduled to run hourly.
5. Monitor Cron Job Logs
Regularly check the
cron.log
file to monitor the execution of your script and identify any potential issues.View the Last Few Entries:
Follow the Log in Real-Time:
Tips:
6. Troubleshooting
If the cron job isn't executing as expected, consider the following troubleshooting steps:
a. Check Cron Service Status
Ensure that the cron service is running.
If Not Running: Start the cron service.
b. Verify Script Paths and Permissions
Execute Permissions: Confirm that the shell script and
chromedriver
have execute permissions.Expected Output:
c. Environment Variables
Cron jobs run in a limited environment. Ensure that any necessary environment variables are set within the shell script.
For example, in
run_auto_jobs.sh
, you can set environment variables before activating the virtual environment:d. Script Output
Review the
cron.log
for any error messages that can provide insights into what might be going wrong.Run the Application
With all dependencies installed, configurations set, and automation in place, you can now run the application.
Ensure the Virtual Environment is Activated:
Navigate to the Project Directory (If Not Already There):
Run the Main Script with Your Resume:
Replace
resumes/your_resume.pdf
with the path to your resume PDF.Expected Outcome:
Example Output:
Troubleshooting
If you encounter any issues during setup or execution, consider the following troubleshooting steps:
1. Chromedriver Not Found or Incorrect Version
Ensure ChromeDriver Version Matches Chrome Version:
Verify that the ChromeDriver version matches your installed Google Chrome version.
Re-download ChromeDriver if Versions Mismatch:
If there's a mismatch, download the correct version from the Chrome for Testing site.
2. Permissions Issues
Grant Execute Permissions:
3. Virtual Environment Issues
Activate Virtual Environment:
Reinstall Dependencies:
4. Configuration Errors
Double-Check Configuration Files:
Ensure that
secrets.yaml
,config.yaml
, andplain_text_resume.yaml
have the correct paths and credentials.5. Selenium Errors
Check Selenium and WebDriver Installation:
Ensure that both Selenium and ChromeDriver are correctly installed and accessible.
Specify ChromeDriver Path Explicitly:
If Selenium cannot locate ChromeDriver, specify the path explicitly in your scripts as shown in the Fixing a Known Bug section.
6. General Debugging
Use Logging Outputs:
Check the logs for detailed error messages to identify where the issue is occurring.
Refer to Official Documentation:
Conclusion
By following this step-by-step guide, you have successfully set up and configured the Auto_Jobs_Applier_AIHawk project on your Windows machine using Ubuntu via WSL. The modifications to remove interactive prompts and the setup of a cron job ensure that your application runs automatically every hour, streamlining your job application process.
Summary of Steps:
If you continue to experience issues, please refer to the troubleshooting section or reach out to the project maintainers for further assistance.
Good luck with your automated job applications! 🚀
Additional Tips
Use Environment Variables for Secrets:
For enhanced security, consider using environment variables to store sensitive information like LinkedIn credentials instead of hardcoding them in
secrets.yaml
.Keep Software Updated:
Regularly update your system packages, Google Chrome, and ChromeDriver to ensure compatibility and security.
Backup Configuration Files:
Before making significant changes, back up your configuration files to prevent data loss.
Virtual Environment Management:
If you encounter issues with the virtual environment, consider deleting and recreating it to ensure a clean setup.
Why is this change necessary?
No response
Additional context
No response