Skip to content

Commit bbbcdfd

Browse files
authored
Update IV Data Pipeline on the Command Line.py
1 parent f377bd9 commit bbbcdfd

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

Data Processing in Shell/IV Data Pipeline on the Command Line.py

+36-2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
*** day of month (1-31)
195195
**** month (1-12)
196196
***** day of week (1-7)
197+
197198
"""
198199

199200
"""
@@ -202,14 +203,15 @@
202203
-Which of the following is the correct Crontab syntax for execute the Python model script (model.py) every hour, on the 15 minute of an hour?
203204
(e.g. 12:15 PM, 1:15 AM, 2:15 AM, etc)?
204205
205-
Answer : 15 * * * * python model.py
206-
"""
206+
Answer : 15 * * * * python model.
207207
208+
"""
208209

209210
"""
210211
### Scheduling a job with crontab
211212
212213
-Verify that there are currently no CRON jobs currently scheduled via CRONTAB.
214+
213215
"""
214216
# Verify that there are no CRON jobs currently scheduled
215217
crontab -l
@@ -225,3 +227,35 @@
225227

226228
# Verify that the CRON job has been added
227229
crontab -l
230+
231+
232+
"""
233+
### Model production on the command line
234+
235+
In this capstone exercise, we will practice how to set up an end-to-end Python script automation process step by step.
236+
237+
Instructions
238+
100 XP
239+
Use pip to install the Python dependencies listed in the requirements.txt file.
240+
241+
-Now that the necessary Python dependencies have been installed, run the create_model.py script on the command line.
242+
-We have verified that the Python model can be run. Next step is to automate this job so it runs every minute. Use CRONTAB to schedule a per minute run of the Python
243+
script create_model.py.
244+
-Print the job scheduled in CRONTAB to verify that the CRON job is scheduled correctly.
245+
246+
"""
247+
# Preview both Python script and requirements text file
248+
cat create_model.py
249+
cat requirements.txt
250+
251+
# Pip install Python dependencies in requirements file
252+
pip install -r requirements.txt
253+
254+
# Run Python script on command line
255+
python create_model.py
256+
257+
# Add CRON job that runs create_model.py every minute
258+
echo "* * * * * python create_model.py" | crontab
259+
260+
# Verify that the CRON job has been scheduled via CRONTAB
261+
crontab -l

0 commit comments

Comments
 (0)