pirovc / metameta

Other
23 stars 10 forks source link

Error in job clean_files while creating output file... #4

Closed Thomieh73 closed 7 years ago

Thomieh73 commented 7 years ago

Hi Vitor,

When I am running the mm pipeline I encountered the following error.

Error in job clean_files while creating output file K1T0/profiles/archaea_bacteria/dudes_clean_files.done. ClusterJobException in line 2 of /usit/abel/u1/thhaverk/miniconda3/envs/metameta/opt/metameta/scripts/clean_files.sm: Error executing rule clean_files on cluster (jobid: 9, jobscript: /work/users/thhaverk/MMresults_test/.snakemake/tmp.odfh3g06/snakejob.clean_files.9.sh). For detailed error see the cluster log. Job failed, going on with independent jobs.

The error is repeated with each running of the rule.

So I check the clusterlog file and I find the following:

Error in job clean_files while creating output file K1T0/profiles/archaea_bacteria/dudes_clean_files.done. RuleException: CalledProcessError in line 13 of /usit/abel/u1/thhaverk/miniconda3/envs/metameta/opt/metameta/scripts/clean_files.sm: Command 'if [ -d "K1T0/dudes/" ]; then if [ ! "$(ls -A K1T0/dudes/)" ]; then rm -dv K1T0/dudes/; fi; fi >> K1T0/log/archaea_bacteria/dudes_clean_files.log 2>&1' returned non-zero exit status 1 File "/usit/abel/u1/thhaverk/miniconda3/envs/metameta/opt/metameta/scripts/clean_files.sm", line 13, in __rule_clean_files File "/usit/abel/u1/thhaverk/miniconda3/envs/metameta/lib/python3.5/concurrent/futures/thread.py", line 55, in run Exiting because a job execution failed. Look above for error message

I only see this error when setting the keepfiles option to "0" in the yaml file. When I set it to keep files, no errors occur.

I looked at the other issue, but I am not sure if I am dealing here with a similar issue.

metameta is run from a slurm with the command:

metameta --configfile MM_config_4.yaml --keep-going -j 999 --cluster-config MM_cluster.json --cluster "sbatch --account=nn9244k --mem-per-cpu={cluster.mem} --partition={cluster.partition} --cpus-per-task={cluster.cpus-per-task} --time={cluster.time} --job-name={cluster.job-name} --output={cluster.output}"

the cluster settings for the clean_files job are:

"clean_files": { "job-name": "clean_f", "output": "clusterlog/clean_files.%j.out", "mem": "3800M", "cpus-per-task": 1, "time": "2:0:0"

Cheers Thomas

pirovc commented 7 years ago

Hi Thomas,

The line in question is only checking if a folder is empty and deletes it. Not sure what could be causing the error.

Could you also send me the contents of the file: K1T0/log/archaea_bacteria/dudes_clean_files.log

Best, Vitor

Thomieh73 commented 7 years ago

Hi Vitor, the file dudes_clean_files.log contains the following:

removed `K1T0/dudes/archaea_bacteria/K1T0.sam'
removed `K1T0/dudes/archaea_bacteria/K1T0.results.out'
removed directory: `K1T0/dudes/archaea_bacteria'
rm: cannot remove `K1T0/dudes/': Is a directory

If I look at the file clean_files.sm I see the run command: `if not config["keepfiles"]:

Remove individual folder (sample/tool/database)

                    shell("rm -rfv {wildcards.sample}/{wildcards.tool}/{wildcards.database}/ > {log} 2>&1")
                    # Remove tool folder if it existst and there's no more data (sample/tool)
                    shell('if [ -d "{wildcards.sample}/{wildcards.tool}/" ]; then if [ ! "$(ls -A {wildcards.sample}/{wildcards.tool}/)" ]; then rm -dv {wildcards.sample}/{wildcards.tool}/; fi; fi >> {log} 2>&1')`

The last "rm" does not have the -r flag. Could that be the cause?

Best, Thomas

pirovc commented 7 years ago

Hi Thomas,

In this case I don't use the -r flag because I just want to delete such folder if it's actually empty, that's why the -d flag and the if before. That needs to be done becuase I could have other folders there when using more than one database.

Could you please check if the directory is empty with the command ls -A K1T0/dudes/

Vitor

Thomieh73 commented 7 years ago

Hi, Vitor, I understand it. I checked the folder:


-bash-4.1$ ls -lA
total 0
-bash-4.1$ ls -la
total 1
drwxrwxr-x 2 thhaverk users 0 Sep 12 16:40 .
drwxrwxr-x 9 thhaverk users 7 Sep 12 16:40 ..

It is empty.

by the way, I update the previous post, with the output of the log file. I saw that I had forgotten a little part.

Best Thomas

pirovc commented 7 years ago

Hi Thomas,

I believe some version of rm can work differently with -d parameter. If possible can you send me the version of your rm rm --version so I can check if that is actually what is happening?

I think I'll change to -r since I check if the folder is empty before anyways. A new version with some bug fixes (inclusding this) will be avaiable in the next days.

Best, Vitor

Thomieh73 commented 7 years ago

Hi Vitor, I check the rm version. this is the output:

rm (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.

Okay, than I will wait and I will install the new version after the weekend.

pirovc commented 7 years ago

Hi Thomas,

That should be the case, since the rm -d was implemented around 2012 as far as I found on google.

If you wish to use MetaMeta with keepfiles: 0 before the update, just replace your file /usit/abel/u1/thhaverk/miniconda3/envs/metameta/opt/metameta/scripts/clean_files.sm with the new version clean_files.sm

Vitor

Thomieh73 commented 7 years ago

Okay Vitor, I will try out if this removes the error. Will let you know.

Best Thomas

Thomieh73 commented 7 years ago

Hey Vitor, I replaced the clean_files.sm file with the new version and then I ran metameta with the keepfiles option set to: "0".

That resolved the issue. super. That gives a clean output. Best Thomas

Thomieh73 commented 7 years ago

I am closing the issue