This is not what you want, since the default configuration runs “interactive” jobs that is they run sequentially on the head node of your cluster and don’t use the batch queue. Sourcing configuration file: '~/R/x86_64-pc-linux-gnu-library/3.0.2/lib/BatchJobs/etc/BatchJobs_global_config.R' I’m assuming here that you installed BatchJobs into ~/R/x86_64-pc-linux-gnu-library/3.0.2/lib if not, change for the location of your R libraries. When you load the BatchJobs library, you’ll see a message telling you that a global configuration file was sourced. Note the variables used in line 6: you need to recall their names later on. R CMD BATCH -no-save -no-restore "" /dev/stdout ![]() # we merge R output with stdout from PBS, which gets then logged via -o option # remove this line if your cluster does not support arrayjobs ![]() I use that file pretty much as-is, except (a) there appears to be a stray “M” character at the end of line 6 which I removed and (b) my system uses modules, so requires the addition of module load R before R is called. I started by creating a working directory named jobs and copying the example template file for the TORQUE batch queue system, simple.tmpl, from Github: mkdir ~/jobs The other, discussed in the next section, is a more general configuration file which defines more generally how BatchJobs runs (email notifications, database system and so on). One of these is a template file which tells R how to submit jobs to the batch queue. One aspect of the BatchJobs documentation that I found unclear was that the term “configuration file” is used, but it was not always obvious which file was being discussed.īatchJobs requires two files. My system runs an older R version (3.0.2) and so gave a warning that testthat was not available, but that did not prevent installation of the other packages. Install_github("tudo-r/BatchExperiments") # if required As always, it’s for “Linux-like” systems. What I wanted was a simple, step-by-step guide to setting up for a first-time user. Their documentation is quite extensive with useful examples, but I found it a little disjointed and confusing. Two promising packages there: BatchJobs and BatchExperiments. The machine has 63 virtual compute nodes and uses the TORQUE batch queue system to allocate nodes to compute jobs.įirst stop: the CRAN Task View High-Performance and Parallel Computing with R. I use this to send every recipient with multiple invoices.I was asked recently to look at some R code which performs “embarrassingly parallel” computations (the same function, multiple times, different parameters) and see whether I could modify it to run on one of our high-performance computing clusters. # Send emails to multiple recipients with corresponding attachments # If the file names include the recipient’s ID at the start of 4 letters, the file(s) would be added to the listįor dirpath,dirname,filename in os.walk(path): # Address spreadsheet includes “Code” which is the recipient’s name/ID, and “add”, the email address # Upload multiple attachments/files that meet the conditions/requirementsĪddr = pd.read_excel(r"C:\Users\Desktop\address.xlsx") Mail.subject = sub.encode('utf-8').decode('utf-8') Outlook = win32.Dispatch('outlook.application')ĭef sendmail(receiver, attachment, subject):īody = "Please find the attached supporting documents for member rebates." ![]() Part.add_header('Content-Disposition', "attachment filename= %s" % filename) Part = MIMEBase('application', 'octet-stream') Can someone help me on this.įrom import MIMEMultipartĮ = pd.read_csv("C:\\Users\\Hp-Pc\\Desktop\\mail.csv") I have tried my best but I keep on getting an errors in the code. So for example, I need attach TEST.pdf and another TEST123.pdf file and send to (please refer the image). ![]() The new requirement is that, I need to attach multiple files to a single recipient (can't send multiple mails). This code works perfectly fine but the requirement has changed. So what this does is, the code will access the csv file, fetch the email address and the corresponding excel file and sends the mail with the attachment. I have written a code to send mails with attachment to multiple users using Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |