forestav commited on
Commit
f19244a
·
1 Parent(s): 21a7cf3

show last update

Browse files
Files changed (4) hide show
  1. .github/workflows/actions.yml +19 -17
  2. app.py +10 -0
  3. main.py +0 -9
  4. timestamp2.txt +1 -1
.github/workflows/actions.yml CHANGED
@@ -1,35 +1,37 @@
1
- name: Run main.py on schedule
2
 
3
  on:
4
  schedule:
5
- # Run the workflow every three hours
6
- - cron: "0 */3 * * *"
7
- workflow_dispatch: # Allows manual triggering of the workflow
8
 
9
  jobs:
10
- run-python-script:
11
  runs-on: ubuntu-latest
12
-
13
- env: # Define environment variables for the entire job
14
- PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
15
-
16
  steps:
17
- # Step 1: Check out the code
18
- - name: Check out repository
19
  uses: actions/checkout@v3
 
 
20
 
21
- # Step 2: Set up Python
22
  - name: Set up Python
23
  uses: actions/setup-python@v4
24
  with:
25
- python-version: "3.12" # Match your Python version
26
 
27
- # Step 3: Install dependencies
28
  - name: Install dependencies
29
  run: |
30
  python -m pip install --upgrade pip
31
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32
 
33
- # Step 4: Run the script
34
- - name: Run main.py
 
35
  run: python main.py
 
 
 
 
 
 
 
 
1
+ name: Update Job Database
2
 
3
  on:
4
  schedule:
5
+ - cron: "0 */6 * * *" # Runs every 6 hours
6
+ workflow_dispatch: # Allows manual triggering
 
7
 
8
  jobs:
9
+ update-database:
10
  runs-on: ubuntu-latest
 
 
 
 
11
  steps:
12
+ - name: Checkout repository
 
13
  uses: actions/checkout@v3
14
+ with:
15
+ token: ${{ secrets.GITHUB_TOKEN }}
16
 
 
17
  - name: Set up Python
18
  uses: actions/setup-python@v4
19
  with:
20
+ python-version: "3.10"
21
 
 
22
  - name: Install dependencies
23
  run: |
24
  python -m pip install --upgrade pip
25
+ pip install -r requirements.txt
26
 
27
+ - name: Run update script
28
+ env:
29
+ PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
30
  run: python main.py
31
+
32
+ - name: Commit and push if timestamp changed
33
+ run: |
34
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
35
+ git config --local user.name "github-actions[bot]"
36
+ git add timestamp2.txt
37
+ git diff --quiet && git diff --staged --quiet || (git commit -m "Update timestamp" && git push)
app.py CHANGED
@@ -6,6 +6,7 @@ from typing import Optional
6
  import re
7
  from pinecone_handler import PineconeHandler
8
  from time_handling import read_timestamp
 
9
 
10
  def extract_text_from_pdf(pdf_file) -> str:
11
  """Extract text content from PDF file"""
@@ -103,6 +104,15 @@ def format_job_description(description: str, truncated: bool = False) -> str:
103
 
104
  def main():
105
  st.title("Resume-Based Job Search")
 
 
 
 
 
 
 
 
 
106
  st.write("Upload your resume to find matching job opportunities")
107
 
108
  # Initialize PineconeHandler
 
6
  import re
7
  from pinecone_handler import PineconeHandler
8
  from time_handling import read_timestamp
9
+ from datetime import datetime
10
 
11
  def extract_text_from_pdf(pdf_file) -> str:
12
  """Extract text content from PDF file"""
 
104
 
105
  def main():
106
  st.title("Resume-Based Job Search")
107
+
108
+ # Add last update time display
109
+ try:
110
+ last_update = read_timestamp()
111
+ last_update_dt = datetime.strptime(last_update, "%Y-%m-%d %H:%M:%S")
112
+ st.markdown(f"*Last database update: {last_update_dt.strftime('%B %d, %Y at %I:%M %p')}*")
113
+ except Exception as e:
114
+ st.warning("Unable to retrieve last update time")
115
+
116
  st.write("Upload your resume to find matching job opportunities")
117
 
118
  # Initialize PineconeHandler
main.py CHANGED
@@ -14,7 +14,6 @@ logging.basicConfig(stream=sys.stdout, level=LOG_LEVEL, format=LOG_FORMAT, datef
14
  def keep_updated():
15
  handler = PineconeHandler()
16
  last_timestamp = read_timestamp()
17
- counter = 0
18
 
19
  while True:
20
  new_timestamp = timestamp_now()
@@ -27,14 +26,6 @@ def keep_updated():
27
 
28
  write_timestamp(new_timestamp)
29
  break
30
- #counter += 1
31
- #log.info(f"Completed update {counter} of {MAX_UPDATES}")
32
-
33
- #if counter == MAX_UPDATES:
34
- # break
35
-
36
- #log.info(f"Waiting {SLEEP_TIME_MINUTES} minutes before collecting ads again")
37
- #sleep(SLEEP_TIME_MINUTES * 60)
38
 
39
  log.info('Finished')
40
 
 
14
  def keep_updated():
15
  handler = PineconeHandler()
16
  last_timestamp = read_timestamp()
 
17
 
18
  while True:
19
  new_timestamp = timestamp_now()
 
26
 
27
  write_timestamp(new_timestamp)
28
  break
 
 
 
 
 
 
 
 
29
 
30
  log.info('Finished')
31
 
timestamp2.txt CHANGED
@@ -1 +1 @@
1
- 2024-12-22T13:55:53
 
1
+ 2024-12-22T16:19:41