My current approach is to first remove the old model, save the new model , using the shell is no problem , but it just doesn't work automatically using crontab. Any idea why or how to solve this? Thanks for the help.
The error is that main programm does not wait for the subprocess.call to return. I think that this is the problem but not sure.
This is my current command:
subprocess.call('dse hadoop fs -rmr /root/recommend_model', shell=True)
A possible solution just to check that it was correctly executed is to wait a returncode.
Here the link to subprocess module: https://docs.python.org/2/library/subprocess.html
You can wait the return code in you script:
if (subprocess.call(command, args) == 0):
print("We are proceeding)
else:
print("Something went wrong executing %s" % command)
Additionally try as suggested to redirect to a log file your script execution with 2>&1 > mickey.log
Last but not least some subprocess/os.system suggestions available here: Controlling a python script from another script
python: run external program and direct output to file and wait for finish
Please let me know if this solve your issue.