<commit_before>importPackage(java.lang);
importPackage(java.io);
importPackage(java.util);
importPackage(org.ow2.proactive.scripting.helper.filetransfer);
importPackage(org.ow2.proactive.scripting.helper.filetransfer.driver);
importPackage(org.ow2.proactive.scripting.helper.filetransfer.initializer);

//This script example ilustrates the use of org.objectweb.proactive.scheduler.helper API to get files from the remote host to the local node

//set this to true if yo want to have your logs in a file on the remote machine
var logToFile = false;
//set this to true to ienable debug mode
var mode_debug= false;

var task_id=System.getProperty("pas.task.id");
var logsFile = "task_"+task_id+".log";


log ("Start Get Files Script");
//only if logToFile is true:
log("logs file at "+System.getProperty("java.io.tmpdir")+File.separator+logsFile);





  //-------------- Script ARGS --------------------------
     if (args.length<5)
      {
        log("Script usage: host username password working_dir_on_node file1 [file2] ... [filen]");
        log("Not enough parameters. Script cannot be executed");
        throw new Exception ("Not enough parameters.");
      }


		//host where the file is to be copied from
		var host = args[0];
		debug("host="+host);

		//identification to the remote host
		var username=args[1];
		debug("user="+username);
		var password=args[2];
		debug("password="+password);
		//tmp/working folder on node
		var working_dir_on_node = args[3];
		debug("local folder: "+working_dir_on_node);

		debug("Files to copy: ");
		var files = new LinkedList();

		var k=0;
		for (k=4;k<args.length;k++)
			{
			files.add(args[k]);
			debug(args[k]);
			}




		//how long will it take?
		var t1=System.currentTimeMillis();


		//-------- Create Local Folder if it doesn't exist
		var tFolder = new File(working_dir_on_node);
		if (!tFolder.isDirectory())
		if (tFolder.mkdirs())
		{
			debug ("Folder have been created: "+tFolder);
		}
		else
		{
		  debug("Could not create folder " + tFolder );
		}



     //--------------- Define Driver to be used for file transfer (or use default one) ------------


	//----(SCP Protocol) Use this code for in order to use SCP_Trilead_Driver to copy the files ----
	//(By default, the initializaer will use SCP_Trilead_Driver to init the connection)
	var ftInit= new FileTransfertInitializerSCP(host, username, password);

    // ----------- OR ----------------



	//----(SFTP Protocol) Use this code for in order to use SFTP_Trilead_Driver to copy the files ----
	//	var driver = new SFTP_Trilead_Driver();
	//	var ftInit= new FileTransfertInitializerSCP(host, username, password,driver.getClass());

    // ----------- OR ----------------
	//---- (SFTP Protocol) Use this code for in order to use SFTP_VFS_Driver to copy the files ----
	//		var driver = new SFTP_VFS_Driver();
	//		var ftInit= new FileTransfertInitializerSCP(host, username, password,driver.getClass());


    // ----------- OR ----------------
	//---- (FTP Protocol) Use this code for in order to use FTP_VFS_Driver to copy the files ----


	//		var driver = new FTP_VFS_Driver();
	//		var ftInit= new FileTransfertInitializerFTP(host, username, password,driver.getClass());


		// ---------- Create  session for the file transfer ----------------
		var session = new FileTransfertSession(ftInit);

		// -------------------- Copy the files --------------------------
		session.getFiles(files, working_dir_on_node);


		var t2=System.currentTimeMillis();
		log("Get files script ended. Copying files took "+(t2-t1)/1000+" seconds = "+(t2-t1)/60000)+" minutes";



function log(msg)
{
	msg="(getScript) "+msg;
		 if (logToFile)
			  {
				   ScriptLoggerHelper.logToFile(logsFile,"\n"+msg+"\n");
			  }

		 println(msg);
}


function debug(msg)
{
       if (mode_debug)
       {
	log ("DEBUG: "+msg);
       }
}

	<commit_msg>sample file transfer script update<commit_after>importPackage(java.lang);
importPackage(java.io);
importPackage(java.util);
importPackage(org.ow2.proactive.scripting.helper.filetransfer);
importPackage(org.ow2.proactive.scripting.helper.filetransfer.driver);
importPackage(org.ow2.proactive.scripting.helper.filetransfer.initializer);

//This script example ilustrates the use of org.objectweb.proactive.scheduler.helper API to get files from the remote host to the local node

//set this to true if yo want to have your logs in a file on the remote machine
var logToFile = false;
//set this to true to enable debug mode
var mode_debug= false;

var task_id=System.getProperty("pas.task.id");
var logsFile = "task_"+task_id+".log";


log ("Start Get Files Script");
//only if logToFile is true:
log("logs file at "+System.getProperty("java.io.tmpdir")+File.separator+logsFile);





  //-------------- Script ARGS --------------------------
     if (args.length<5)
      {
        log("Script usage: host username password destination_folder_on_node file1 [file2] ... [filen]");
        log("Not enough parameters. Script cannot be executed");
        throw new Exception ("Not enough parameters.");
      }


		//host where the file is to be copied from
		var host = args[0];
		debug("remote host="+host);

		//identification to the remote host
		var username=args[1];
		debug("user="+username);
		var password=args[2];
		debug("password="+password);
		//for the scp implementation- the driver will first try to connect through ssh keys
		//and will use the password only if the connection fails. 
		
		var working_dir_on_node = args[3];
		debug("destination folder on the compute node: "+working_dir_on_node);

		debug("Files to copy: ");
		var files = new LinkedList();

		var k=0;
		for (k=4;k<args.length;k++)
			{
			files.add(args[k]);
			debug(args[k]);
			}


		//how long will it take?
		var t1=System.currentTimeMillis();


		//-------- Create Local Folder if it doesn't exist
		var tFolder = new File(working_dir_on_node);
		if (!tFolder.isDirectory())
		if (tFolder.mkdirs())
		{
			debug ("Folder have been created: "+tFolder);
		}
		else
		{
		  debug("Could not create folder " + tFolder );
		}



     //--------------- Define Driver to be used for file transfer (or use default one) ------------


	//----(SCP Protocol) Use this code for in order to use SCP_Trilead_Driver to copy the files ----
	//(By default, the initializer will use SCP_Trilead_Driver to init the connection)
	var ftInit= new FileTransfertInitializerSCP(host, username, password);

    // ----------- OR ----------------



	//----(SFTP Protocol) Use this code for in order to use SFTP_Trilead_Driver to copy the files ----
	//	var driver = new SFTP_Trilead_Driver();
	//	var ftInit= new FileTransfertInitializerSCP(host, username, password,driver.getClass());

    // ----------- OR ----------------
	//---- (SFTP Protocol) Use this code for in order to use SFTP_VFS_Driver to copy the files ----
	//		var driver = new SFTP_VFS_Driver();
	//		var ftInit= new FileTransfertInitializerSCP(host, username, password,driver.getClass());


    // ----------- OR ----------------
	//---- (FTP Protocol) Use this code for in order to use FTP_VFS_Driver to copy the files ----


	//		var driver = new FTP_VFS_Driver();
	//		var ftInit= new FileTransfertInitializerFTP(host, username, password,driver.getClass());


		// ---------- Create  session for the file transfer ----------------
		var session = new FileTransfertSession(ftInit);

		// -------------------- Copy the files --------------------------
		session.getFiles(files, working_dir_on_node);


		var t2=System.currentTimeMillis();
		log("Get files script ended. Copying files took "+(t2-t1)/1000+" seconds = "+(t2-t1)/60000)+" minutes";



function log(msg)
{
		msg="(getFiles.js) "+msg;
		 if (logToFile)
			  {
				   ScriptLoggerHelper.logToFile(logsFile,"\n"+msg+"\n");
			  }

		 println(msg);
}


function debug(msg)
{
       if (mode_debug)
       {
		log ("DEBUG: "+msg);
       }
}

	
{'fraction_non_alphanumeric': 0.17697768762677485, 'fraction_numerical': 0.006845841784989858, 'mean_word_length': 2.7282608695652173, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '919404', 'n_tokens_mistral': 2582, 'n_tokens_neox': 2387, 'n_words': 729}