
    'i
                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZ 	 d dlZddl
mZmZ ddlmZ deeef   ddfd	Zdd
Zy# e	$ r Y 'w xY w)    N)Path)Union   )job_environmentutils)
get_loggerfolderreturnc                    t        |       t        j                  d<   t        j                         }|j
                  }t               }|j                  d|        |j                  d|j                          d}t        |      D ]3  }|j                  j                         r nt        j                  d       5 |j                  j                         st        d| d|j                         	 t        j                  j!                  |j                        }t        j                         }|j#                  ||       |j%                         }|j                  d       ~t        j&                  |j(                        5 }t        j*                  d	|f|       ~|j                  d
       ddd       y# 1 sw Y   yxY w# t,        $ r}		 t        j&                  |j(                        5 }t        j*                  dt/        j0                         f|       ddd       n# 1 sw Y   nxY wn-# t,        $ r!}
|j3                  d|	 d|
        Y d}
~
nd}
~
ww xY w|j3                  d       |	d}	~	ww xY w)a#  Loads a pickled job, runs it and pickles the output

    Parameter
    ---------
    folder: Path/str
        path of the folder where the job pickle will be stored (with a name containing its uuid)

    Side-effect
    -----------
    Creates a picked output file next to the job file.
    SUBMITIT_FOLDERzStarting with zLoading pickle: <   r   zWaited for z4 seconds but could not find submitted jobs in path:
zJob completed successfullysuccessz#Exiting after successful completionNerrorzCould not dump error:
z

because of z$Submitted job triggered an exception)strosenvironr   JobEnvironmentpathsr   infosubmitted_picklerangeexiststimesleepRuntimeErrorr   DelayedSubmissionload_handle_signalsresulttemporary_save_pathresult_picklecloudpickle_dump	Exception	traceback
format_excr   )r	   envr   logger	wait_time_delayedr   tmppathr   	dumperrors              R/var/www/stems/demucs_env/lib/python3.12/site-packages/submitit/core/submission.pyprocess_jobr.      s%    %(KBJJ !

(
(
*CIIE\F
KK.&'
KK"5#9#9":;<I9 !!((*

1 !!((*)$YZ_ZpZpYqr
 	
))..u/E/EF,,.E7+!01&&u':':; 	?w""Iv#6@KK=>	? 	? 	?  	V**5+>+>? S7&&1E1E1G'H'RS S S 	VLL25'TUU	V;<ss   2BG +F6-G 6F?;G ?G 	I1H,++H	H,H(	$H,+I,,	I5II,II,,I1c                      t        j                  d      } | j                  dt        d       | j	                         }t        |j                         y )Nz	Run a job)descriptionr	   z/Folder where the jobs are stored (in subfolder))typehelp)argparseArgumentParseradd_argumentr   
parse_argsr.   r	   )parserargss     r-   submitit_mainr9   H   sB    $$=F
s1bcD    )r
   N)r3   r   r   r$   pathlibr   typingr   numpyImportError r   r   r'   r   r   r.   r9    r:   r-   <module>rA      s`     	    	 % -dCi( -T -`o  		s   A A
	A
