My Swiss Army Knife of Useful Stufff

Important links

Tips

  • Getting CERN users info
    $ phonebook -lo <username>
    $ phonebook <full_name>
  • To list all files greater than ~10G:
    $ find . -type f -size +10G -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
  • To print only directories
    $ ls -d */
  • To convert the EPOCH time in human readable time
    $ date -d @<epoch_time>
  • Show all output lines of command except those containing the string str.
    $ command | grep -v <str>
  • Command line to comment out all lines in a file (using vim):
    :1,$s/^/#/g
  • grep: looking for a pattern (in this case, X86_64) -R: recursively -H: print the filename for each match -n: Prefix each line of output with the line number within its input file. -s: Suppress error messages about nonexistent or unreadable files. -I Process a binary file as if it did not contain matching data; -i: Ignore case distinctions in both the PATTERN and the input files.
    $ grep -R -H -I -n -s X86_64 *
  • Commenting/uncommenting files with sed (link):
    sed -i '/<pattern>/s/^/#/g' file (to comment out)
    sed -i '/<pattern>/s/^#//g' file (to uncomment)

LXPLUS

      $ fs whereis /afs/cern.ch/user/s/silveira/ /afs/cern.ch/work/s/silveira/

GRID

  • Grid Administration: commands related to proxy:
    $ voms-proxy-init -debug -voms cms       # the cert/key pair of files should be placed under ~/.globus
    $ voms-proxy-init --valid 192:00 -voms cms:/cms/Role=production
    $ globusrun -a -r osgce.hepgrid.uerj.br   # testing authentication
    $ voms-proxy-info -all -file <your proxy>

CERN Batch HTCondor

    $ condor_hold -reason 'just messing around' 6502.11
    $ condor_rm -const 'CMS_JobType =?= "Merge"'
    $ condor_submit <submit.file>
    $ watch -n 1 'condor_q'
    $ condor_qedit 763.0 RequestMemory 2200
    $ condor_qedit 261.0 DESIRED_Sites "\"T1_US_FNAL\""
    $ condor_qedit -const 'JobStatus=?=1 && (CMS_JobType =?= "Production" || CMS_JobType =?= "Processing")' JobPrio 999999
    $ condor_qedit -const 'JobStatus=?=1 && isUndefined(REQUIRED_OS)' REQUIRED_OS "\"any\""
    $ condor_q -af:h MaxWallTimeMins
    $ condor_q -af:h WMAgent_SubTaskName RequestCpus RequestMemory RequestDisk MachineCount AccountingGroup MaxWallTimeMins
    $ condor_q -global | grep running
    $ condor_q -hold
    $ condor_status -submitters
    $ condor_status -run
    $ condor_rm <job_id>
    $ condor_q -bet <job_id>
    $ condor_q -global -better-analyze <job_id>
    $ condor_prio -p 20 <job_id>  ### Giving the maximum priority in the local queue
    $ condor_userprio -all -allusers

CMSSW dev

Git

    $ git reset --soft HEAD~1
    $ git reset FILENAME    ### to unstage a file
    $ git checkout -- FILENAME ### to rollback that file to its original state before that commit
  • Getting stats from the diff between two branches.
    $ git diff --stat --color comp..comp_gcc481
  • Retrieving the diff of a file betweem two branches:
    $ git diff --color comp..comp_gcc481 reqmon.spec
  • Test PR locally
     $ cmsrel (cmssw-release-IB-or-not)
     $ cmsenv
     $ git cms-addpkg (corresponding-package)
     $ git fetch origin pull/<ID>/head:[BRANCHNAME] (BRANCHNAME local)
     $ git checkout [BRANCHNAME] (PR changes will be local)
   * If PR in another remote:
     $ git fetch <another_remote> pull/[pull-request-id]/head:[BRANCHNAME]
     $ git checkout [BRANCHNAME]
   * for CMSSW:
     $ cmsrel CMSSW_13_3_X_2023-10-27-1100    # the latest available IB
     $ cd CMSSW_13_3_X_2023-10-27-1100/src
     $ git cms-init
     $ git cms-merge-topic <PR_NUMBER>
     $ git cms-checkdeps -a
     $ scram b -j 8

Analysis tools

MccM

-- GustavoGilDaSilveira - 2022-05-15

Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r16 - 2024-05-21 - GustavoGilDaSilveira
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback