Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (docker): Fix docker entrypoint #7

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN apt-get update && apt-get install wget && \

COPY . .

ENTRYPOINT ["python3", "src/data_collection/main.py"]
ENTRYPOINT ["python3", "src/main.py"]
82 changes: 41 additions & 41 deletions src/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,55 @@ def init(cls):

cur.execute(
"""CREATE TABLE IF NOT EXISTS scrapes(
id SERIAL PRIMARY KEY,
query TEXT,
contract_type TEXT,
location TEXT,
country_code TEXT,
started_at INTEGER,
ended_at INTEGER)"""
id SERIAL PRIMARY KEY,
query TEXT,
contract_type TEXT,
location TEXT,
country_code TEXT,
started_at INTEGER,
ended_at INTEGER)"""
)

cur.execute(
"""CREATE TABLE IF NOT EXISTS companies(
id TEXT PRIMARY KEY,
name TEXT,
sector TEXT,
office_location TEXT,
website_url TEXT,
presentation TEXT,
looking_for TEXT,
good_to_know TEXT,
creation_year TEXT,
number_employees TEXT,
parity_percent_women TEXT,
parity_percent_men TEXT,
average_age TEXT,
url TEXT)"""
id TEXT PRIMARY KEY,
name TEXT,
sector TEXT,
office_location TEXT,
website_url TEXT,
presentation TEXT,
looking_for TEXT,
good_to_know TEXT,
creation_year TEXT,
number_employees TEXT,
parity_percent_women TEXT,
parity_percent_men TEXT,
average_age TEXT,
url TEXT)"""
)

cur.execute(
"""CREATE TABLE IF NOT EXISTS job_offers(
id TEXT,
company_id TEXT,
title TEXT,
url TEXT,
description TEXT,
preferred_experience TEXT,
recruitment_process TEXT,
contract TEXT,
location TEXT,
salary TEXT,
starting_date TEXT,
remote TEXT,
experience TEXT,
education TEXT,
date TEXT,
deleted_at DATE DEFAULT NULL,
scrape_id INTEGER,
PRIMARY KEY (id, company_id),
FOREIGN KEY (company_id) REFERENCES companies(id),
FOREIGN KEY (scrape_id) REFERENCES scrapes(id))"""
id TEXT,
company_id TEXT,
title TEXT,
url TEXT,
description TEXT,
preferred_experience TEXT,
recruitment_process TEXT,
contract TEXT,
location TEXT,
salary TEXT,
starting_date TEXT,
remote TEXT,
experience TEXT,
education TEXT,
date TEXT,
deleted_at DATE DEFAULT NULL,
scrape_id INTEGER,
PRIMARY KEY (id, company_id),
FOREIGN KEY (company_id) REFERENCES companies(id),
FOREIGN KEY (scrape_id) REFERENCES scrapes(id))"""
)

con.commit()
Expand Down
8 changes: 4 additions & 4 deletions src/helper/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def scrape_jobs(args):
executor.map(process_job_offer, total_job_offers_urls)


def update_deleted(args):
def update_deleted():
db_conn = ScrapeDB.get_con()
db_cur = db_conn.cursor()

Expand Down Expand Up @@ -117,9 +117,9 @@ def update_deleted(args):

db_cur.execute(
"""UPDATE job_offers
SET deleted_at = %(deleted_at)s
WHERE (id, company_id) IN %(deleted_job_offers_ids)s
""",
SET deleted_at = %(deleted_at)s
WHERE (id, company_id) IN %(deleted_job_offers_ids)s
""",
{
"deleted_at": str(datetime.now().date()),
"deleted_job_offers_ids": tuple(deleted_job_offers_ids),
Expand Down
64 changes: 32 additions & 32 deletions src/welcome_to_the_jungle/job_offer.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,38 +258,38 @@ def save_to_db(self) -> None:
row_data["scrape_id"] = ScrapeDB.scrape_id
self.__db_cur.execute(
"""INSERT INTO job_offers(
id,
company_id,
title,
url,
description,
preferred_experience,
recruitment_process,
scrape_id,
contract,
location,
salary,
starting_date,
remote,
experience,
education,
date) VALUES (
%(id)s,
%(company_id)s,
%(title)s,
%(url)s,
%(description)s,
%(preferred_experience)s,
%(recruitment_process)s,
%(scrape_id)s,
%(contract)s,
%(location)s,
%(salary)s,
%(starting_date)s,
%(remote)s,
%(experience)s,
%(education)s,
%(date)s) ON CONFLICT DO NOTHING""",
id,
company_id,
title,
url,
description,
preferred_experience,
recruitment_process,
scrape_id,
contract,
location,
salary,
starting_date,
remote,
experience,
education,
date) VALUES (
%(id)s,
%(company_id)s,
%(title)s,
%(url)s,
%(description)s,
%(preferred_experience)s,
%(recruitment_process)s,
%(scrape_id)s,
%(contract)s,
%(location)s,
%(salary)s,
%(starting_date)s,
%(remote)s,
%(experience)s,
%(education)s,
%(date)s) ON CONFLICT DO NOTHING""",
row_data,
)

Expand Down