Skip to content

Commit

Permalink
Merge branch '119.iso8601-cycling' of github.com:cylc/cylc into 1021.…
Browse files Browse the repository at this point in the history
…no_clock_tr_360
  • Loading branch information
benfitzpatrick committed Jul 29, 2014
2 parents 69d2bae + 34c5b22 commit 8da095f
Show file tree
Hide file tree
Showing 211 changed files with 1,030 additions and 902 deletions.
31 changes: 19 additions & 12 deletions bin/cylc-broadcast
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,17 @@ See also 'cylc reload' - reload a modified suite definition at run time."""
parser = cop( usage, pyro=True )

parser.add_option( "-t", "--tag", metavar="CYCLE_POINT",
help="Target cycle point. Defaults "
"to 'all-cycles' with --set and --cancel, "
help="(Deprecated). "
"Target cycle point. More than one can be added. "
"Defaults to 'all-cycle-points' with --set and --cancel, "
"and nothing with --clear.",
action="append", dest="tags", default=[] )
action="append", dest="point_strings", default=[] )

parser.add_option( "-p", "--point", metavar="CYCLE_POINT",
help="Target cycle point. More than one can be added. "
"Defaults to 'all-cycle-points' with --set and --cancel, "
"and nothing with --clear.",
action="append", dest="point_strings", default=[] )

parser.add_option( "-n", "--namespace", metavar="NAME",
help="Target namespace. Defaults to 'root' with "
Expand All @@ -123,9 +130,9 @@ parser.add_option( "-c", "--cancel", metavar="[SEC]ITEM",
action="append", dest="cancel", default=[] )

parser.add_option( "-C", "--clear",
help="Cancel all broadcasts, or with -t/--tag, "
help="Cancel all broadcasts, or with -p/--point, "
"-n/--namespace, cancel all broadcasts to targeted "
"namespaces and/or cycle points. Use '-C -t all-cycles' "
"namespaces and/or cycle points. Use '-C -p all-cycle-points' "
"to cancel all all-cycle broadcasts without canceling "
"all specific-cycle broadcasts.",
action="store_true", dest="clear", default=False )
Expand Down Expand Up @@ -182,7 +189,7 @@ except Exception, x:
if options.show or options.showtask:
if options.showtask:
try:
name, tag = options.showtask.split(TaskID.DELIM)
name, point_string = options.showtask.split(TaskID.DELIM)
except ValueError:
parser.error( "TASKID must be NAME"+TaskID.DELIM+"CYCLE_POINT" )
try:
Expand All @@ -200,7 +207,7 @@ if options.show or options.showtask:

if options.clear:
try:
settings = proxy.clear( options.namespaces, options.tags )
settings = proxy.clear( options.namespaces, options.point_strings )
except Exception,x:
if debug:
raise
Expand All @@ -218,13 +225,13 @@ if options.expire:
else:
sys.exit(0)

# implement namespace and tag defaults here
# implement namespace and cycle point defaults here
namespaces = options.namespaces
if not namespaces:
namespaces = ["root"]
tags = options.tags
if not tags:
tags = ["all-cycles"]
point_strings = options.point_strings
if not point_strings:
point_strings = ["all-cycle-points"]

settings = []
for s in options.set:
Expand Down Expand Up @@ -256,7 +263,7 @@ for setting in settings:
sys.exit(x)

try:
success, msg = proxy.put( namespaces, tags, settings )
success, msg = proxy.put( namespaces, point_strings, settings )
except Exception, x:
if debug:
raise
Expand Down
4 changes: 2 additions & 2 deletions bin/cylc-cat-log
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ if len(args) == 2:

suite_run_dir = sitecfg.get_derived_host_item(suite, 'suite run directory')
suite_run_dao = CylcRuntimeDAO(suite_run_dir)
taskname, ctime = cylc.TaskID.split( taskid )
host = suite_run_dao.get_task_host(taskname, ctime)
taskname, point_string = cylc.TaskID.split( taskid )
host = suite_run_dao.get_task_host(taskname, point_string)
suite_run_dao.close()
owner = None
if host and '@' in host:
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-depend
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dep = args[2]

m = re.match( '^(\w+)'+cylc.TaskID.DELIM_RE+'(\w+)$', dep )
if m:
#name, ctime = m.groups()
#name, point_string = m.groups()
msg = dep + ' succeeded'
else:
msg = dep
Expand Down
14 changes: 7 additions & 7 deletions bin/cylc-graph
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def on_url_clicked( widget, url, event, window ):
right_click_menu( event, url, type='live task', window=window )

def right_click_menu( event, task_id, type='live task', window=None ):
name, ctime = cylc.TaskID.split( task_id )
name, point_string = cylc.TaskID.split( task_id )

menu = gtk.Menu()
menu_root = gtk.MenuItem( task_id )
Expand Down Expand Up @@ -180,22 +180,22 @@ if options.namespaces:
else:
# SUITE DEPENDENCY GRAPH

start_ctime = None
stop_ctime = None
start_point_string = None
stop_point_string = None

if len(args) > 1:
# got START
start_ctime = args[1]
start_point_string = args[1]

if len(args) == 3:
# got STOP
stop_ctime = args[2]
stop_point_string = args[2]
else:
stop_ctime = start_ctime
stop_point_string = start_point_string

window = MyDotWindow( suite, suiterc, options.templatevars,
options.templatevars_file, watchers,
start_ctime, stop_ctime )
start_point_string, stop_point_string )

window.widget.connect( 'clicked', on_url_clicked, window )

Expand Down
8 changes: 5 additions & 3 deletions bin/cylc-hold
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ whole_suite = True
if len(args) == 3:
whole_suite = False
name = args[1]
tag = args[2]
prompt( 'Hold task(s) ' + name + ' at ' + tag + ' in ' + suite, options.force )
point_string = args[2]
prompt( 'Hold task(s) ' + name + ' at ' + point_string + ' in ' + suite,
options.force )
elif len(args) == 1:
prompt( 'Hold suite ' + suite, options.force )
else:
Expand All @@ -64,7 +65,8 @@ try:
if whole_suite:
result = proxy.put( 'hold suite now' )
else:
result = proxy.put( 'hold task now', name, tag, options.is_family )
result = proxy.put( 'hold task now', name, point_string,
options.is_family )
except Exception, x:
if cylc.flags.debug:
raise
Expand Down
17 changes: 11 additions & 6 deletions bin/cylc-housekeeping
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ consider two-step archiving and cleanup:
parser = OptionParser( usage )

parser.add_option( "--cycletime",
metavar='YYYYMMDDHH',
help="Deprecated. Cycle point, defaults to $CYLC_TASK_CYCLE_POINT",
action="store", dest="point_string" )

parser.add_option( "--point",
metavar='YYYYMMDDHH',
help="Cycle point, defaults to $CYLC_TASK_CYCLE_POINT",
action="store", dest="ctime" )
action="store", dest="point_string" )

#parser.add_option( "--dry-run",
# help="print what would be done, but don't do it.",
Expand Down Expand Up @@ -145,10 +150,10 @@ cylc.flags.debug = options.debug
if len(args) != 1 and len( args ) != 4 and len(args) != 5:
parser.error( "Wrong number of arguments" )

if options.ctime:
ctime = options.ctime
if options.point_string:
point_string = options.point_string
elif 'CYLC_TASK_CYCLE_POINT' in os.environ:
ctime = os.environ[ 'CYLC_TASK_CYCLE_POINT' ]
point_string = os.environ[ 'CYLC_TASK_CYCLE_POINT' ]
else:
parser.error( "Use --cycletime or define $CYLC_TASK_CYCLE_POINT" )

Expand All @@ -166,7 +171,7 @@ if len(args) == 0 or len(args) > 5:

if len(args) == 1:
file = args[0]
config_file( file, ctime,
config_file( file, point_string,
only=options.only, excpt=options.excpt, mode=options.mode,
cheap=options.cheap ).action( batchsize )
else:
Expand All @@ -178,7 +183,7 @@ else:
if len(args) == 5:
destn = args[4]

config_line( source, match, opern, ctime, offset, destn,
config_line( source, match, opern, point_string, offset, destn,
mode=options.mode, cheap=options.cheap ).action( batchsize )

print '\nFINISH: ', get_current_time_string(display_sub_seconds=True)
17 changes: 10 additions & 7 deletions bin/cylc-insert
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,29 @@ See also 'cylc submit', for running tasks without the scheduler.
argdoc=[("REG", "Suite name"),
('MATCH', 'Task or family name matching regular expression'),
('CYCLE_POINT', 'Cycle point (e.g. date-time or integer)'),
('[STOP]', 'Optional stop tag for inserted task.' )])
('[STOP_POINT]', 'Optional stop cycle point for inserted task.' )])

(options, args) = parser.parse_args()

suite, pphrase = prep_pyro( args[0], options ).execute()

name = args[1]
tag = args[2]
point_string = args[2]
if len(args) == 4:
stoptag = args[3]
# TODO ISO - VALIDATE stoptag
stop_point_string = args[3]
# TODO ISO - VALIDATE stop_point_string
else:
stoptag = None
stop_point_string = None

try:
proxy = cylc_pyro_client.client( suite, pphrase, options.owner,
options.host, options.pyro_timeout,
options.port ).get_proxy( 'command-interface' )
prompt( 'Insert ' + name + ' at ' + tag + ' in ' + suite, options.force )
result = proxy.put( 'insert task', name, tag, options.is_family, stoptag )
prompt( 'Insert ' + name + ' at ' + point_string + ' in ' + suite,
options.force )
result = proxy.put(
'insert task', name, point_string, options.is_family,
stop_point_string )
except Exception, x:
if cylc.flags.debug:
raise
Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-kill
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Kill a 'submitted' or 'running' task and update the suite state accordingly.
suite, pphrase = prep_pyro( args[0], options ).execute()

name = args[1]
tag = args[2]
point_string = args[2]

try:
proxy = cylc_pyro_client.client( suite, pphrase, options.owner,
options.host, options.pyro_timeout,
options.port ).get_proxy( 'command-interface' )
prompt( 'Kill task ' + name + ' a ' + tag + ' in ' + suite, options.force )
result = proxy.put( 'kill tasks', name, tag, options.is_family )
prompt( 'Kill task ' + name + ' a ' + point_string + ' in ' + suite, options.force )
result = proxy.put( 'kill tasks', name, point_string, options.is_family )

except Exception, x:
if cylc.flags.debug:
Expand Down
4 changes: 2 additions & 2 deletions bin/cylc-lockclient
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def check_task_spec( task_spec ):
check_suite_spec( suite )

try:
(name, tag) = task_id.split( cylc.TaskID.DELIM )
(name, point_string) = task_id.split( cylc.TaskID.DELIM )
except ValueError:
raise SystemExit( task_spec + " - Please specify SUITE:TASK"+cylc.TaskID.DELIM+"CYCLE" )

cycle = tag
cycle = point_string

return ( suite, task_id )

Expand Down
21 changes: 11 additions & 10 deletions bin/cylc-monitor
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ try:

seen_time = {}
seen_name = {}
c_time_list = []
point_string_list = []
name_list = []

for task_id in task_ids:

name = states[ task_id ][ 'name' ]
c_time = states[ task_id ][ 'label' ]
point_string = states[ task_id ][ 'label' ]

if c_time not in seen_time.keys():
seen_time[ c_time ] = True
c_time_list.append( c_time )
if point_string not in seen_time.keys():
seen_time[ point_string ] = True
point_string_list.append( point_string )

if name not in seen_name.keys():
seen_name[ name ] = True
Expand All @@ -170,9 +170,9 @@ try:

# initialize a dict-of-dicts to store display information
# for all tasks at each current cycle point
# task_info[ c_time ][ task_name ] = info
# task_info[ point_string ][ task_name ] = info
task_info = {}
for rt in c_time_list:
for rt in point_string_list:
task_info[ rt ] = {}
for name in name_list:
# initialise with blank string of the same size as
Expand All @@ -186,7 +186,7 @@ try:
for task_id in task_ids:

name = states[ task_id ][ 'name' ]
ctime = states[ task_id ][ 'label' ]
point_string = states[ task_id ][ 'label' ]

name = states[ task_id ][ 'name' ]
state = states[ task_id ][ 'state' ]
Expand All @@ -201,7 +201,8 @@ try:
# color displayed info according to run status
ctrl_start = task_state.ctrl[state]
# construct the display string for this task
task_info[ ctime ][ name ] = ctrl_start + name + ctrl_end + abd
task_info[ point_string ][ name ] = (
ctrl_start + name + ctrl_end + abd)

# construct an array of lines to blit to the screen

Expand Down Expand Up @@ -242,7 +243,7 @@ try:
blit.append( '\033[1;31m' + foo + ctrl_end )

# construct a line of text to display for each cycle point
for rt in c_time_list:
for rt in point_string_list:
indx = rt
line = '\033[1;34m' + rt + ctrl_end

Expand Down
7 changes: 4 additions & 3 deletions bin/cylc-poll
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ that were recorded as submitted or running when the suite went down.
suite, pphrase = prep_pyro( args[0], options ).execute()

name = args[1]
tag = args[2]
point_string = args[2]

try:
proxy = cylc_pyro_client.client( suite, pphrase, options.owner,
options.host, options.pyro_timeout,
options.port ).get_proxy( 'command-interface' )
prompt( 'Poll task ' + name + ' at ' + tag + ' in ' + suite, options.force )
result = proxy.put( 'poll tasks', name, tag, options.is_family )
prompt( 'Poll task ' + name + ' at ' + point_string + ' in ' + suite,
options.force )
result = proxy.put( 'poll tasks', name, point_string, options.is_family )

except Exception, x:
if cylc.flags.debug:
Expand Down
4 changes: 2 additions & 2 deletions bin/cylc-purge
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ internal triggering simulation.]""",
suite, pphrase = prep_pyro( args[0], options ).execute()

target = args[1]
stoptag = args[2]
stop_point_string = args[2]

if not cylc.TaskID.is_valid_id( target ):
sys.exit( "Invalid Task ID: " + target )
Expand All @@ -79,7 +79,7 @@ task_id = target
name, start = cylc.TaskID.split( target )

# TODO ISO - VALIDATE STOP CYCLE_POINT
stop = stoptag
stop = stop_point_string

try:
proxy = cylc_pyro_client.client( suite, pphrase, options.owner,
Expand Down
10 changes: 7 additions & 3 deletions bin/cylc-release
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ whole_suite = True
if len(args) == 3:
whole_suite = False
name = args[1]
tag = args[2]
prompt( 'Release task(s) ' + name + ' at ' + tag + ' in ' + suite, options.force )
point_string = args[2]
prompt(
'Release task(s) ' + name + ' at ' + point_string + ' in ' + suite,
options.force
)
else:
prompt( 'Release suite ' + suite, options.force )

Expand All @@ -60,7 +63,8 @@ try:
if whole_suite:
result = proxy.put( 'release suite' )
else:
result = proxy.put( 'release task', name, tag, options.is_family )
result = proxy.put( 'release task', name, point_string,
options.is_family )
except Exception, x:
if cylc.flags.debug:
raise
Expand Down
Loading

0 comments on commit 8da095f

Please sign in to comment.