removed script
This commit is contained in:
parent
2d45a653fc
commit
83888cd2f9
31
cycle.sh
31
cycle.sh
@ -1,31 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Function to run the command
|
|
||||||
run_command() {
|
|
||||||
python manage.py ingester &
|
|
||||||
PID=$!
|
|
||||||
echo "Started process with PID: $PID"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to terminate the command
|
|
||||||
interrupt_command() {
|
|
||||||
kill -SIGINT $PID
|
|
||||||
echo "Interrupted process with PID: $PID"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run the command initially
|
|
||||||
run_command
|
|
||||||
|
|
||||||
# Loop to restart the command every 2 hours until ingester_done.flag is found
|
|
||||||
while [ ! -f ingester_done.flag ]; do
|
|
||||||
# Wait for 2 hours (7200 seconds)
|
|
||||||
sleep 7200
|
|
||||||
|
|
||||||
# Terminate the command
|
|
||||||
interrupt_command
|
|
||||||
|
|
||||||
# Restart the command
|
|
||||||
run_command
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "ingester_done.flag found. Exiting script."
|
|
@ -42,7 +42,7 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
|
|
||||||
#fetching the file list
|
#fetching the file list
|
||||||
directory = input_with_timeout(f"Please enter the path to the directory containing the csv files [{previous_choice}]: ", 30)
|
directory = input_with_timeout(f"[{current_time()}] Please enter the path to the directory containing the csv files [{previous_choice}]: ", 30)
|
||||||
if not directory:
|
if not directory:
|
||||||
directory = previous_choice
|
directory = previous_choice
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
|
|
||||||
csv_files = glob.glob(os.path.join(directory, '*csv*'))
|
csv_files = glob.glob(os.path.join(directory, '*csv*'))
|
||||||
self.stdout.write(f"Files found: {len(csv_files)}.")
|
self.stdout.write(f"[{current_time()}] Files found: {len(csv_files)}.")
|
||||||
self.stdout.write("Populating the file database...")
|
self.stdout.write(f"[{current_time()}] Populating the file database...")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class Command(BaseCommand):
|
|||||||
if created:
|
if created:
|
||||||
new_files_count += 1
|
new_files_count += 1
|
||||||
#show how many duplicates were already in db
|
#show how many duplicates were already in db
|
||||||
self.stdout.write(f"File database populated. \n{len(csv_files) - new_files_count} were already in the database.")
|
self.stdout.write(f"[{current_time()}] File database populated. \n{len(csv_files) - new_files_count} were already in the database.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class Command(BaseCommand):
|
|||||||
for catalog_file in catalog_files:
|
for catalog_file in catalog_files:
|
||||||
|
|
||||||
if catalog_file.status == 'INGESTED':
|
if catalog_file.status == 'INGESTED':
|
||||||
self.stdout.write(f"[{current_time()}]Skipping {catalog_file.name} as it is already ingested.")
|
self.stdout.write(f"[{current_time()}] Skipping {catalog_file.name} as it is already ingested.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
file_path = os.path.join(directory, catalog_file.name)
|
file_path = os.path.join(directory, catalog_file.name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user