| 419 | |
| 420 | === Example 4: Change hidden parameter of the run_card to change the default behavior of running |
| 421 | |
| 422 | This cluster request madgraph to reduce the number of submitted jobs (and therefore submitting longer jobs). |
| 423 | By setting the associated parameter in the run_card if the user did not specify those. (implemeted with/for Roberto Franscini) |
| 424 | |
| 425 | __init__.py |
| 426 | {{{ |
| 427 | ## import the required files |
| 428 | # example: import maddm_interface as maddm_interface # local file |
| 429 | # import madgraph.various.cluster as cluster #MG5 distribution file |
| 430 | |
| 431 | import madxgraph.various.cluster as cluster |
| 432 | import time |
| 433 | |
| 434 | #local file |
| 435 | |
| 436 | class MYcluster(cluster.PBSCluster): |
| 437 | |
| 438 | def modify_interface(self, run_interface): |
| 439 | """ |
| 440 | routine which allow to modify the run_card/mg5cmd object to change the |
| 441 | default behavior of the runs. |
| 442 | This is called at the time of the compilation of the run_card. |
| 443 | Note that this function can be called multiple times by run. |
| 444 | """ |
| 445 | run_card = run_interface.run_card |
| 446 | run_card.set('survey_nchannel_per_job',10, changeifuserset=False) |
| 447 | run_card.set('refine_evt_by_job', 25000, changeifuserset=False) |
| 448 | return super(MYcluster, self).modify_interface(run_interface) |
| 449 | |
| 450 | |
| 451 | # Three types of functionality are allowed in a plugin |
| 452 | # 1. new output mode |
| 453 | # 2. new cluster support |
| 454 | # 3. new interface |
| 455 | |
| 456 | # 1. Define new output mode |
| 457 | # example: new_output = {'myformat': MYCLASS} |
| 458 | # madgraph will then allow the command "output myformat PATH" |
| 459 | # MYCLASS should inherated of the class madgraph.iolibs.export_v4.VirtualExporter |
| 460 | new_output = {} |
| 461 | |
| 462 | # 2. Define new way to handle the cluster. |
| 463 | # example new_cluster = {'mycluster': MYCLUSTERCLASS} |
| 464 | # allow "set cluster_type mycluster" in madgraph |
| 465 | # MYCLUSTERCLASS should inherated from madgraph.various.cluster.Cluster |
| 466 | new_cluster = {'new_pbs': MYcluster} |
| 467 | |
| 468 | |
| 469 | # 3. Define a new interface (allow to add/modify MG5 command) |
| 470 | # This can be activated via ./bin/mg5_aMC --mode=PLUGINNAME |
| 471 | ## Put None if no dedicated command are required |
| 472 | new_interface = None |
| 473 | |
| 474 | |
| 475 | ########################## CONTROL VARIABLE #################################### |
| 476 | __author__ = 'Mattelaer Olivier' |
| 477 | __email__ = 'o.p.c.mattelaer@durham.ac.uk' |
| 478 | __version__ = (1,0,0) |
| 479 | minimal_mg5amcnlo_version = (2,5,0) |
| 480 | maximal_mg5amcnlo_version = (1000,1000,1000) |
| 481 | latest_validated_version = (2,6,0) |
| 482 | |
| 483 | }}} |