Best Python code snippet using autotest_python
slurm.py
Source:slurm.py  
...154    cluster = get_cluster()155    submitcmd = "sbatch"156    if cluster == "CADES":157        submitcmd += " -A birthright" 158    if not is_valid_partition(partition, cluster):159        raise PartitionException(partition, cluster)160    requestpartition = partition161    if requestpartition == "default":162        requestpartition = get_default_partition(cluster)163    elif requestpartition == "fast":164        requestpartition = get_fast_partition(cluster)165    submitcmd +=" -N {NUMNODES} -c {NUMTASKS} --partition={PARTITION}".format(NUMNODES=numnodes, NUMTASKS=numtasks, PARTITION=requestpartition)166    if jobarray:167        submitcmd += " --array={ARRAYMIN}-{ARRAYMAX}".format(ARRAYMIN=jobarray[0], ARRAYMAX=jobarray[1])168    if dependency > 0:169        submitcmd += " -d {DEP}".format(DEP=dependency)170    submitcmd += " -J {JOBNAME} -o {LOGFILE}".format(JOBNAME=jobname, LOGFILE=logfile)171    runcommand = command172    if cluster == "CADES":173        submitcmd += " --mem=4G --time={MAXTIME}".format(MAXTIME=maxtime)174        # On CADES scripts must run inside a container175        runcommand = "{} {}".format(os.path.join(os.getenv("SUBSTRUCTURE_ROOT"), "cadescontainerwrapper.sh"), command)176    submitcmd += " {COMMAND}".format(COMMAND=runcommand)177    logging.debug("Submitcmd: {}".format(submitcmd))178    submitResult = subprocess.run(submitcmd, shell=True, stdout=subprocess.PIPE)179    sout = submitResult.stdout.decode("utf-8")180    toks = sout.split(" ")181    jobid = int(toks[len(toks)-1])182    return jobid183def submit_dependencies(command: str, jobname: str, logfile: str, partition: str = "short", numnodes: int = 1, numtasks: int = 1, jobarray = None, dependency: list = [], dependency_mode: str = "afterany", maxtime: str ="8:00:00") -> int:184    cluster = get_cluster()185    submitcmd = "sbatch"186    if cluster == "CADES":187        submitcmd += " -A birthright" 188    if not is_valid_partition(partition, cluster):189        raise PartitionException(partition, cluster)190    requestpartition = partition191    if requestpartition == "default":192        requestpartition = get_default_partition(cluster)193    elif requestpartition == "fast":194        requestpartition = get_fast_partition(cluster)195    submitcmd +=" -N {NUMNODES} -c {NUMTASKS} --partition={PARTITION}".format(NUMNODES=numnodes, NUMTASKS=numtasks, PARTITION=requestpartition)196    if jobarray:197        submitcmd += " --array={ARRAYMIN}-{ARRAYMAX}".format(ARRAYMIN=jobarray[0], ARRAYMAX=jobarray[1])198    if len(dependency):199        dependencystring = dependency_mode200        for dep in dependency:201            dependencystring += ":{}".format(dep)202        submitcmd += " --dependency={DEP}".format(DEP=dependencystring)...test_isomorphism.py
Source:test_isomorphism.py  
...53    are_isomorphic, S = are_fractionally_isomorphic(G, H, algorithm=algorithm)54    assert are_isomorphic55    if algorithm == 'cep':56        partition1, partition2 = S57        assert is_valid_partition(G, partition1)58        assert is_valid_partition(H, partition2)59        assert is_partition_equitable(G, partition1)60        assert is_partition_equitable(H, partition2)61        assert are_common_partitions(G, partition1, H, partition2)62    else:63        assert verify_isomorphism(G, H, S)64def test_are_fractionally_isomorphic():65    # Test some graphs that are fractionally isomorphic but not isomorphic.66    _assert_fractionally_isomorphic()67    # Test some graphs that are isomorphic, and therefore fractionally68    # isomorphic as well.69    G = graph_from_file('data/graph3.txt')70    H = graph_from_file('data/graph4.txt')71    _assert_fractionally_isomorphic(G, H)72    # Test for graphs that are not fractionally isomorphic....mcdownloader.py
Source:mcdownloader.py  
...25            logging.error("%s", e)26        except AliTrainDB.TrainNotFoundException as e:27            logging.error("%s", e)28    def set_partition_for_download(self, partition: str):29        if not is_valid_partition(self._cluster, partition):30            raise PartitionException(partition, self._cluster)31        self._partitionDownload = partition32    def set_maxtime(self, maxtime: str):33        self._maxtime = maxtime34    def set_token(self, cert: str, key: str):35        self._tokens["cert"] = cert36        self._tokens["key"] = key37    def submit_sample(self, sample: str):38        if not self._trainrun:39            logging.error("Failed initializing train run")40            return41        jobid_download = self.submit_download(sample)42        if not jobid_download:43            return...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
