benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf c04b895c-f9e2-51cd-a830-f5c9eb9d9073

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import subprocess
import os
import time
import glob

def task_func(r_script_path: str, output_path: str, duration: int) -> (bool, str):
    """
    This function executes an R script and verifies if the output file is generated within a given duration.
    
    Parameters:
    - r_script_path (str): The absolute path to the R script to be executed.
    - output_path (str): The absolute path where the output CSV file is expected to be generated.
    - duration (int): The time, in seconds, within which the output file should be generated.
    
    Returns:
    - tuple containing:
      - bool: True if the output file is generated within the specified duration, False otherwise.
      - str: A message indicating whether the file was generated successfully or not. If the generation is successful, the message will be 'File generated successfully within the specified duration.'; otherwise, it will be 'File not generated within the specified duration.'
    
    Requirements:
    - subprocess
    - os
    - time
    - glob
    
    Example:
    >>> task_func('/path_to_script/MyrScript.r', '/path_to_output/', 10)
    (True, 'File generated successfully within the specified duration.')
    >>> task_func('/path_to_script/InvalidScript.r', '/path_to_output/', 5)
    (False, 'File not generated within the specified duration.')
    """

instruct prompt

This function executes an R script and verifies if the output file is generated within a given duration.
The function should output with:
    tuple containing:
    bool: True if the output file is generated within the specified duration, False otherwise.
    str: A message indicating whether the file was generated successfully or not. If the generation is successful, the message will be 'File generated successfully within the specified duration.'; otherwise, it will be 'File not generated within the specified duration.'
You should write self-contained code starting with:

Code

import subprocess
import os
import time
import glob
def task_func(r_script_path: str, output_path: str, duration: int) -> (bool, str):

code prompt

Code

import subprocess
import os
import time
import glob
def task_func(r_script_path: str, output_path: str, duration: int) -> (bool, str):

entry point

task_func

libs

  • glob
  • subprocess
  • os
  • time

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import